You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by zs...@apache.org on 2017/03/30 11:38:57 UTC
[23/30] incubator-weex git commit: * [android] Reduce parameters
passed in for 'init()' in vue1.0.
* [android] Reduce parameters passed in for 'init()' in vue1.0.
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/f8e8f585
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/f8e8f585
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/f8e8f585
Branch: refs/heads/0.12-dev
Commit: f8e8f585a45a67d656d8bd5d09beda3d465ef4d3
Parents: eb2eba8
Author: bruno.duan <br...@gmail.com>
Authored: Wed Mar 22 12:22:36 2017 +0800
Committer: bruno.duan <br...@gmail.com>
Committed: Wed Mar 22 12:22:36 2017 +0800
----------------------------------------------------------------------
html5/frameworks/legacy/app/ctrl/init.js | 25 ++++++++++---------------
html5/frameworks/legacy/static/create.js | 5 +----
2 files changed, 11 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/f8e8f585/html5/frameworks/legacy/app/ctrl/init.js
----------------------------------------------------------------------
diff --git a/html5/frameworks/legacy/app/ctrl/init.js b/html5/frameworks/legacy/app/ctrl/init.js
index d9c403a..efb59ee 100644
--- a/html5/frameworks/legacy/app/ctrl/init.js
+++ b/html5/frameworks/legacy/app/ctrl/init.js
@@ -21,11 +21,8 @@ import { updateActions } from './misc'
* @param {object} app
* @param {string} code
* @param {object} data
- * @param {string} bundleUrl
- * @param {string} bundleDigest
- * @param {string} codeCachePath
*/
-export function init (app, code, data, services, bundleUrl, bundleDigest, codeCachePath) {
+export function init (app, code, data, services) {
console.debug('[JS Framework] Intialize an instance with:\n', data)
let result
@@ -121,11 +118,7 @@ export function init (app, code, data, services, bundleUrl, bundleDigest, codeCa
__weex_viewmodel__: bundleVm,
weex: weexGlobalObject
}, timerAPIs, services)
- if (!callFunctionNative(globalObjects,
- functionBody,
- bundleUrl,
- bundleDigest,
- codeCachePath)) {
+ if (!callFunctionNative(globalObjects, functionBody)) {
// If failed to compile functionBody on native side,
// fallback to callFunction.
callFunction(globalObjects, functionBody)
@@ -156,13 +149,10 @@ function callFunction (globalObjects, body) {
/**
* Call a new function generated on the V8 native side.
* @param {object} globalObjects
- * @param {string} code
- * @param {string} url
- * @param {string} digest
- * @param {string} path
+ * @param {string} body
* @return {boolean} return true if no error occurred.
*/
-function callFunctionNative (globalObjects, body, url, digest, path) {
+function callFunctionNative (globalObjects, body) {
if (typeof compileAndRunBundle !== 'function') {
return false
}
@@ -186,7 +176,12 @@ function callFunctionNative (globalObjects, body, url, digest, path) {
script += '} )'
try {
- fn = compileAndRunBundle(script, url, digest, path)
+ const weex = globalObjects.weex || {}
+ const config = weex.config || {}
+ fn = compileAndRunBundle(script,
+ config.bundleUrl,
+ config.bundleDigest,
+ config.codeCachePath)
if (fn && typeof fn === 'function') {
fn(...globalValues)
isNativeCompileOk = true
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/f8e8f585/html5/frameworks/legacy/static/create.js
----------------------------------------------------------------------
diff --git a/html5/frameworks/legacy/static/create.js b/html5/frameworks/legacy/static/create.js
index 3bf7a98..1c53a34 100644
--- a/html5/frameworks/legacy/static/create.js
+++ b/html5/frameworks/legacy/static/create.js
@@ -27,10 +27,7 @@ export function createInstance (id, code, options, data, info) {
result = initApp(instance,
code,
data,
- services,
- options.bundleUrl,
- options.bundleDigest,
- options.codeCachePath)
+ services)
}
else {
result = new Error(`invalid instance id "${id}"`)