|
@ -113,7 +113,13 @@ define(["jcl","base64","res/js/mobile/expand-mobile.js","biz/js/common/biz-mobil
|
113
|
113
|
WadeMobile.execute = execute;
|
114
|
114
|
|
115
|
115
|
var androidExecute = function(action, args, error, success){
|
116
|
|
var callbackKey = globalErrorKey = action+callbackId++;
|
|
116
|
//执行android方法时,带入到android底层的key值为,回调方法实际的key值 + 用于在top上索引本iframe的WadeMobile的唯一标识。
|
|
117
|
//在android底层,如果发现回调函数的key值包含这个特殊的串。那么将解析这个key。并且取出加回调函数key的后半部分,作为在top上索引本iframe相对应的WadeMobile对象的唯一依据。
|
|
118
|
var tmpKey = action+callbackId++;
|
|
119
|
if(window._WadeMobileSet_Key_ != undefined){
|
|
120
|
tmpKey += window._WadeMobileSet_Key_;
|
|
121
|
}
|
|
122
|
var callbackKey = globalErrorKey = tmpKey;
|
117
|
123
|
if (success || error) {
|
118
|
124
|
callbacks[callbackKey] = {success:success, error:error};
|
119
|
125
|
}
|
|
@ -211,7 +217,12 @@ define(["jcl","base64","res/js/mobile/expand-mobile.js","biz/js/common/biz-mobil
|
211
|
217
|
alert(message);
|
212
|
218
|
}
|
213
|
219
|
},storageCallback:function(action,callback){
|
214
|
|
var callbackKey = action+callbackId;
|
|
220
|
//保存回调函数时,如果为iframe。则回调函数的key为:回调函数的某一标识 + 本iframe窗口的WadeMobile对象在top上的引入的key值。
|
|
221
|
var tmpKey = action+callbackId;
|
|
222
|
if(window._WadeMobileSet_Key_ != undefined){
|
|
223
|
tmpKey += window._WadeMobileSet_Key_;
|
|
224
|
}
|
|
225
|
var callbackKey = tmpKey;
|
215
|
226
|
if (callback) {
|
216
|
227
|
callbackDefine[callbackKey] = {callback:callback};
|
217
|
228
|
}
|
|
@ -351,4 +362,24 @@ define(["jcl","base64","res/js/mobile/expand-mobile.js","biz/js/common/biz-mobil
|
351
|
362
|
Wade.extend(WadeMobile,ExpandMobile);//属性合并,ExpandMobile累加到WadeMobile中
|
352
|
363
|
Wade.extend(WadeMobile,BizMobile);//属性合并,BizMobile累加到WadeMobile中
|
353
|
364
|
return WadeMobile;
|
354
|
|
});
|
|
365
|
});
|
|
366
|
|
|
367
|
//让top对象上,保持有一个当前iframe里面的WadeMobile对象的引用。
|
|
368
|
//注意:在iframe中,_WadeMobileSet_Key_+时间戳表示一个key,此key作为了在top对象上索引iframe中的WadeMobile的依据。
|
|
369
|
//将保持引用的key值存入到当前ifame的window对象上。
|
|
370
|
(function(){
|
|
371
|
if(top != window){
|
|
372
|
if(top.WadeMobileSet == undefined){
|
|
373
|
top.WadeMobileSet = {};
|
|
374
|
}
|
|
375
|
for(var key in top.WadeMobileSet){
|
|
376
|
if(top.WadeMobileSet[key] == undefined && key.indexOf("_WadeMobileSet_Key_") != -1){
|
|
377
|
delete top.WadeMobileSet[key];
|
|
378
|
}
|
|
379
|
}
|
|
380
|
var key = "_WadeMobileSet_Key_" + new Date().getTime();
|
|
381
|
window._WadeMobileSet_Key_ = key;
|
|
382
|
console.log("In an iframe, window.WadeMobile object is referenced top.WadeMobileSet." + key);
|
|
383
|
top.WadeMobileSet[key] = window.WadeMobile;
|
|
384
|
}
|
|
385
|
})();
|