Well, It seems like you could use broadcastChannel [1] to send message (not callback) among pages. If this is not enough, you have to use low level C++ api to implement it by yourself, which is hard to write and not encouraged.
A message among pages is not enough in your case? I'd like to here the detail. FYI: Apache Weex excludes global JS object for security reasons. A malicious hacker could inject a JS snippet containing dangerous function just by loading his URL in Weex. If global JS object is supported, it's very easy for you to excute the JS function provided by malicious hacker in your page. That's reason we design Sandbox. And I'd encourage every developer keeping if for security reason. [1] https://weex.apache.org/zh/docs/api/broadcast-channel.html Best Regards, YorkShen 申远 黄天宁 <[email protected]> 于2020年2月28日周五 上午10:17写道: > OK, i get it. Thanks! > But it is a shame. Both ways are not enough for me. (first is not > suitable,second can not save JS callbacks in Native) > I want a global object in JS, none of Native business. > I use a way like Eventbus for communication between neighbour pages > instead. > > Before Sandbox,I realize an api for *neighbour pages*: > > pagaA push to pagaB witch a *callback((v)=>{})* and *increased pushId*, > pushId && callback both saved in *global* *Date().$CALLBACKS/* > *Date().$PUSHID.* > pageB get *pushId* from params. When pageB *pop(v)*, *search callback by > pushId* in global Date().$CALLBACKS.Then inoke *callbakc(v).* > > It is a very useful api , and the scene is frequent in business > for neighbour pages, which need pageA invoke callback after back from > pageB with params. > > By the way,I find a terrible bug in Jsfm in Android。And i try to find the > reason and solve it > When the type of *inputValue * is *number,*, which *bind with* Component > <input> *property value*。*Precision problem* will happen to* inputValue* . > For example, input 2.5 will show 2.50000, if change *inputValue* to > *string*, > the error disappear. > The behaviour in IOS is all right. > > > 申远 <[email protected]> 于2020年2月27日周四 下午5:49写道: > > > The answer is no, and you should never consider using Weex without > sandbox. > > > > You could however, > > 1. use boradcastChannel [1] for communication between pages > > 2. or use JS service [2] for vendor.js, which is very similar to global > > object. > > > > [1] https://weex.apache.org/zh/docs/api/broadcast-channel.html > > [2] https://weex.apache.org/zh/docs/api/js-service.html > > > > Best Regards, > > YorkShen > > > > 申远 > > > > > > 黄天宁 <[email protected]> 于2020年2月25日周二 下午4:16写道: > > > > > Dear devs: > > > I'm sorry to disturb you about a question about SandBox in both > > > aos/ios. > > > In some case, developer need a global Object to save/share > something > > > for different pages with JS callback,which can not save to Native > > > SharedPreference. > > > *1.In sandBox mode, is there a global Object for mounting?*(It > looks > > > none, from the doc on website : > > > *In particular, the Vue variable are different in each pages, and > even > > > the "global" config of Vue (Vue.config.xxx) only affect the single page > > on > > > Weex.* > > > > > > Android SDK can switch to *unuse sandbox mode*, but IOS SDK looks > > > none. > > > *2.IOS is not just like Android,which is without the selection > > > of isSandBox.* > > > Little understand in C++ sandBox. If you have free time,give me > some > > > pointers,plz. > > > > > > Thanks! > > > > > >
