You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by ha...@apache.org on 2018/12/14 09:26:25 UTC

[incubator-weex] branch master updated: [jsfm] attach data to WeexInstance (#1909)

This is an automated email from the ASF dual-hosted git repository.

hanks pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-weex.git


The following commit(s) were added to refs/heads/master by this push:
     new 183a9c3  [jsfm] attach data to WeexInstance (#1909)
183a9c3 is described below

commit 183a9c336411fdedc5232e1f8e9373e5a3e07906
Author: Zhenfei You <he...@imyzf.com>
AuthorDate: Fri Dec 14 17:26:20 2018 +0800

    [jsfm] attach data to WeexInstance (#1909)
    
    * [jsfm] attach data to WeexInstance
    * [jsfm] change weex.data to weex._nativeData
---
 runtime/api/WeexInstance.js | 3 ++-
 runtime/api/init.js         | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/runtime/api/WeexInstance.js b/runtime/api/WeexInstance.js
index af2fcd7..b6738eb 100644
--- a/runtime/api/WeexInstance.js
+++ b/runtime/api/WeexInstance.js
@@ -53,9 +53,10 @@ function moduleSetter (id, module, method, fn) {
 }
 
 export default class WeexInstance {
-  constructor (id, config) {
+  constructor (id, config, data) {
     setId(this, String(id))
     this.config = config || {}
+    this._nativeData = data || {}
     this.document = new Document(id, this.config.bundleUrl)
     this.requireModule = this.requireModule.bind(this)
     this.importScript = this.importScript.bind(this)
diff --git a/runtime/api/init.js b/runtime/api/init.js
index 6813c5f..c4d914b 100644
--- a/runtime/api/init.js
+++ b/runtime/api/init.js
@@ -90,7 +90,7 @@ function getFrameworkType (id) {
 }
 
 function createInstanceContext (id, options = {}, data) {
-  const weex = new WeexInstance(id, options)
+  const weex = new WeexInstance(id, options, data)
 
   const bundleType = options.bundleType || 'Vue'
   instanceTypeMap[id] = bundleType