-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[proposal] JS service layer #1938
Comments
Additionally we can move native callback management from each framework to common runtime. Here is a simple implementation https://github.com/Jinjiang/weex/blob/jsfm-feature-service/html5/runtime/callback-manager.js |
Seems like it is a runtime hook, good to develope runtime plugin. But I can't get the idea how to register an lib and use it in the bundle code. Any example code? |
After our discussion today. Currently we hope the service concept can be register/unregister from native. Weex has only one runtime in app. If we lost any variable after destroy instance will be memory leak. js bundle code example:
Native register this code example
Native will exec this code to runtime. For example:
|
Codes shown above are not the codes I asked for, If I register a module call 'ABC', |
@seajean |
This PR/issue doesn't receive response since Weex migrated to Apache two years ago and this repository is no longer active yet. Feel free to ask question in new repository and thanks for your contribution. |
This issue is outdated for a long time and will be closed now. You can create a new one if you still have questions. |
To support extendable JS services for different app or business logics without updating JS framework itself and managing JavaScript memories better for all Weex instances.
Background
Purpose
We can make a "service layer" in JavaScript runtime to solve these problems one time. Each JS service can inject some instance variables when such a Weex instance created in such a JS framework. And it can make hooks when the instance created, refreshed or destroyed.
Details
refs: WHATWG HTML Living Standard: 9.6 Broadcasting to other browsing contexts
Changes for Render Layer
(nothing to change)
Changes for JS Runtime
runtime.service.register(name, config)
andruntime.service.unregister(name)
forruntime
.service
whencreateInstance
,refreshInstance
anddestroyInstance
in JS runtime.instanceObjects
parameter increateInstance(id, code, config, data, serviceObjects)
for each JS framework.instanceObjects
to each Weex instance closure whencreateInstance
by a JS framework.Changes for Tools
Developer Experiences
In Weex JS runtime. We can call
Notes
BroadcastChannel
polyfill and HTML5 Timer APIs with this.The text was updated successfully, but these errors were encountered: