weex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acton...@apache.org
Subject [10/39] incubator-weex git commit: * [jsfm] use ES6 export in vanilla framework
Date Tue, 08 Aug 2017 08:55:22 GMT
* [jsfm] use ES6 export in vanilla framework


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/80b3eaed
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/80b3eaed
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/80b3eaed

Branch: refs/heads/0.16-dev
Commit: 80b3eaed2b664a38d230d7841ba94de5a5f992aa
Parents: ac34854
Author: Hanks <zhanghan.me@gmail.com>
Authored: Fri Jul 28 13:53:16 2017 +0800
Committer: Hanks <zhanghan.me@gmail.com>
Committed: Fri Jul 28 13:53:16 2017 +0800

----------------------------------------------------------------------
 html5/frameworks/vanilla/index.js | 35 +++++++++++++---------------------
 1 file changed, 13 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/80b3eaed/html5/frameworks/vanilla/index.js
----------------------------------------------------------------------
diff --git a/html5/frameworks/vanilla/index.js b/html5/frameworks/vanilla/index.js
index 95027a9..45a2e69 100644
--- a/html5/frameworks/vanilla/index.js
+++ b/html5/frameworks/vanilla/index.js
@@ -20,22 +20,22 @@ const config = {}
 
 const instanceMap = {}
 
-function init (cfg) {
+export function init (cfg) {
   config.Document = cfg.Document
   config.Element = cfg.Element
   config.Comment = cfg.Comment
   config.sendTasks = cfg.sendTasks
 }
 
-function registerComponents (components) {}
+export function registerComponents (components) {}
 
-function registerModules (modules) {}
+export function registerModules (modules) {}
 
-function registerMethods (apis) {}
+export function registerMethods (apis) {}
 
-function prepareInstance (id, options, data) {}
+export function prepareInstance (id, options, data) {}
 
-function createInstance (id, code, options, data, serviceObjects) {
+export function createInstance (id, code, options, data, serviceObjects) {
   const document = new config.Document(id, options.bundleUrl)
   const callbacks = {}
 
@@ -71,20 +71,22 @@ function createInstance (id, code, options, data, serviceObjects) {
   globalKeys.push(code)
 
   const result = new Function(...globalKeys)
-  return result(...globalValues)
+  result(...globalValues)
+
+  return { document }
 }
 
-function refreshInstance (id, data) {}
+export function refreshInstance (id, data) {}
 
-function destroyInstance (id) {
+export function destroyInstance (id) {
   delete instanceMap[id]
 }
 
-function getRoot (id) {
+export function getRoot (id) {
   return instanceMap[id].body.toJSON()
 }
 
-function receiveTasks (id, tasks) {
+export function receiveTasks (id, tasks) {
   const jsHandlers = {
     fireEvent: (id, ref, type, data, domChanges) => {
       const document = instanceMap[id]
@@ -112,14 +114,3 @@ function receiveTasks (id, tasks) {
     return results
   }
 }
-
-exports.init = init
-exports.registerComponents = registerComponents
-exports.registerModules = registerModules
-exports.registerMethods = registerMethods
-exports.prepareInstance = prepareInstance
-exports.createInstance = createInstance
-exports.refreshInstance = refreshInstance
-exports.destroyInstance = destroyInstance
-exports.getRoot = getRoot
-exports.receiveTasks = receiveTasks


Mime
View raw message