Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

Commit

Permalink
support #24 #25
Browse files Browse the repository at this point in the history
  • Loading branch information
xinglie committed Aug 30, 2016
1 parent ffd49d6 commit d2a12d5
Show file tree
Hide file tree
Showing 18 changed files with 105 additions and 79 deletions.
14 changes: 6 additions & 8 deletions dist/amd/magix-core-debug.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*3.1.2*/
/*3.1.3*/
/*modules:tmpl,updater,core,viewInit,autoEndUpdate,magix,event,vframe,body,view*/
/*
author:xinglie.lkf@taobao.com
Expand Down Expand Up @@ -866,12 +866,6 @@ G_Mix(Vframe, G_Mix({
/**
* @lends Vframe
*/
/**
* 获取vframe节点
* @type {Vframe}
* @return {Vframe} vframe对象
*/
root: Vframe_Root,
/**
* 获取所有的vframe对象
* @return {Object}
Expand Down Expand Up @@ -926,9 +920,13 @@ G_Mix(G_Mix(Vframe[G_PROTOTYPE], Event), {
if (node && viewPath) {
me.path = viewPath;
po = G_ParseUri(viewPath);
view = po.path;
sign = ++me.$s;
G_Require(po.path, function(TView) {
G_Require(view, function(TView) {
if (sign == me.$s) { //有可能在view载入后,vframe已经卸载了
if (!TView) {
Magix_Cfg.error(Error('cannot load:' + view));
}

View_Prepare(TView);

Expand Down
2 changes: 1 addition & 1 deletion dist/amd/magix-core.js

Large diffs are not rendered by default.

25 changes: 14 additions & 11 deletions dist/amd/magix-debug.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*3.1.2*/
/*3.1.3*/
/*modules:tmpl,updater,share,core,autoEndUpdate,linkage,base,style,viewInit,service,serviceWithoutPromise,router,resource,configIni,viewMerge,magix,event,vframe,body,view*/
/*
author:xinglie.lkf@taobao.com
Expand Down Expand Up @@ -1268,12 +1268,6 @@ G_Mix(Vframe, G_Mix({
/**
* @lends Vframe
*/
/**
* 获取vframe节点
* @type {Vframe}
* @return {Vframe} vframe对象
*/
root: Vframe_Root,
/**
* 获取所有的vframe对象
* @return {Object}
Expand Down Expand Up @@ -1328,9 +1322,13 @@ G_Mix(G_Mix(Vframe[G_PROTOTYPE], Event), {
if (node && viewPath) {
me.path = viewPath;
po = G_ParseUri(viewPath);
view = po.path;
sign = ++me.$s;
G_Require(po.path, function(TView) {
G_Require(view, function(TView) {
if (sign == me.$s) { //有可能在view载入后,vframe已经卸载了
if (!TView) {
Magix_Cfg.error(Error('cannot load:' + view));
}

View_Prepare(TView);

Expand Down Expand Up @@ -2858,8 +2856,10 @@ var Service_FetchFlags_ONE = 1;
var Service_FetchFlags_ALL = 2;
var Service_CacheDone = function(cacheKey, err, fns) {
fns = this[cacheKey]; //取出当前的缓存信息
delete this[cacheKey]; //先删除掉信息
G_ToTry(fns, err, fns.e); //执行所有的回调
if (fns) {
delete this[cacheKey]; //先删除掉信息
G_ToTry(fns, err, fns.e); //执行所有的回调
}
};
var Service_Task = function(done, host, service, total, flag, bagCache) {
var doneArr = [];
Expand Down Expand Up @@ -2947,7 +2947,7 @@ var Service_Send = function(me, attrs, done, flag, save) {
}
var total = attrs.length;
var remoteComplete = Service_Task(done, host, me, total, flag, host.$c);

for (var i = 0, bag; i < total; i++) {
bag = attrs[i];
if (bag) {
Expand All @@ -2968,12 +2968,15 @@ var Service_Send = function(me, attrs, done, flag, save) {
bagCacheKeys[cacheKey] = cacheList;
complete = G_Proxy(Service_CacheDone, bagCacheKeys, cacheKey); //替换回调,详见Service_CacheDone
}

host.$s(bagEntity, complete);

} else { //不需要更新时,直接回调
complete();
}
}
}

return me ;
};
/**
Expand Down
2 changes: 1 addition & 1 deletion dist/amd/magix.js

Large diffs are not rendered by default.

14 changes: 6 additions & 8 deletions dist/cmd/magix-core-debug.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*3.1.2*/
/*3.1.3*/
/*modules:tmpl,updater,core,viewInit,autoEndUpdate,magix,event,vframe,body,view*/
/*
author:xinglie.lkf@taobao.com
Expand Down Expand Up @@ -878,12 +878,6 @@ G_Mix(Vframe, G_Mix({
/**
* @lends Vframe
*/
/**
* 获取vframe节点
* @type {Vframe}
* @return {Vframe} vframe对象
*/
root: Vframe_Root,
/**
* 获取所有的vframe对象
* @return {Object}
Expand Down Expand Up @@ -938,9 +932,13 @@ G_Mix(G_Mix(Vframe[G_PROTOTYPE], Event), {
if (node && viewPath) {
me.path = viewPath;
po = G_ParseUri(viewPath);
view = po.path;
sign = ++me.$s;
G_Require(po.path, function(TView) {
G_Require(view, function(TView) {
if (sign == me.$s) { //有可能在view载入后,vframe已经卸载了
if (!TView) {
Magix_Cfg.error(Error('cannot load:' + view));
}

View_Prepare(TView);

Expand Down
2 changes: 1 addition & 1 deletion dist/cmd/magix-core.js

Large diffs are not rendered by default.

27 changes: 15 additions & 12 deletions dist/cmd/magix-debug.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*3.1.2*/
/*3.1.3*/
/*modules:tmpl,updater,share,core,autoEndUpdate,linkage,base,style,viewInit,service,serviceWithoutPromise,router,resource,configIni,viewMerge,magix,event,vframe,body,view*/
/*
author:xinglie.lkf@taobao.com
Expand Down Expand Up @@ -1280,12 +1280,6 @@ G_Mix(Vframe, G_Mix({
/**
* @lends Vframe
*/
/**
* 获取vframe节点
* @type {Vframe}
* @return {Vframe} vframe对象
*/
root: Vframe_Root,
/**
* 获取所有的vframe对象
* @return {Object}
Expand Down Expand Up @@ -1340,9 +1334,13 @@ G_Mix(G_Mix(Vframe[G_PROTOTYPE], Event), {
if (node && viewPath) {
me.path = viewPath;
po = G_ParseUri(viewPath);
view = po.path;
sign = ++me.$s;
G_Require(po.path, function(TView) {
G_Require(view, function(TView) {
if (sign == me.$s) { //有可能在view载入后,vframe已经卸载了
if (!TView) {
Magix_Cfg.error(Error('cannot load:' + view));
}

View_Prepare(TView);

Expand Down Expand Up @@ -2872,8 +2870,10 @@ var Service_FetchFlags_ONE = 1;
var Service_FetchFlags_ALL = 2;
var Service_CacheDone = function(cacheKey, err, fns) {
fns = this[cacheKey]; //取出当前的缓存信息
delete this[cacheKey]; //先删除掉信息
G_ToTry(fns, err, fns.e); //执行所有的回调
if (fns) {
delete this[cacheKey]; //先删除掉信息
G_ToTry(fns, err, fns.e); //执行所有的回调
}
};
var Service_Task = function(done, host, service, total, flag, bagCache) {
var doneArr = [];
Expand Down Expand Up @@ -2961,7 +2961,7 @@ var Service_Send = function(me, attrs, done, flag, save) {
}
var total = attrs.length;
var remoteComplete = Service_Task(done, host, me, total, flag, host.$c);

for (var i = 0, bag; i < total; i++) {
bag = attrs[i];
if (bag) {
Expand All @@ -2982,12 +2982,15 @@ var Service_Send = function(me, attrs, done, flag, save) {
bagCacheKeys[cacheKey] = cacheList;
complete = G_Proxy(Service_CacheDone, bagCacheKeys, cacheKey); //替换回调,详见Service_CacheDone
}

host.$s(bagEntity, complete);

} else { //不需要更新时,直接回调
complete();
}
}
}

return me ;
};
/**
Expand Down Expand Up @@ -3432,7 +3435,7 @@ Magix.Service = Service;
G_Mix(G_NOOP[G_PROTOTYPE], Event);
G_NOOP.extend = T_Extend;
/**
* 组件基类
* mix Magix.Event的基类
* @name Base
* @constructor
* @borrows Event.fire as #fire
Expand Down
Loading

0 comments on commit d2a12d5

Please sign in to comment.