You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@weex.apache.org by Hanks Zhang <zh...@gmail.com> on 2017/12/04 08:22:34 UTC

Re: Use multi context for Weex page

+1. Currently, multiple js bundles are executed in the same js context, and
the isolation is implemented by js, which is not robust.

In my opinion, the most reasonable solution is to distinguish the "Global
Context" and the "Instance Context", move the logic of instance management
and code execution from js to native.

On this basis, I think there are some sub-problems that need to be solved:

(1). How to expose APIs from Global Context to Instance Context?
(2). How to isolate those exposed APIs?
(3). Adjustments of Vue and Rax.
(4). Impact on performance.
(5). What about the platform APIs and the polyfills? Such as console,
Object.assign, and timer.
(6). Redesign the js service.

Feel free to discuss any of these topics, or add one.

Best regards, Hanks

Re: Use multi context for Weex page

Posted by Hanks Zhang <zh...@gmail.com>.
The implementation in js framework is finished, and I sent a PR [1] to
merge it into the master branch.

The Vue.js framework and native render engines have already achieved it and
all unit tests are passed (poison: [2] validator: [3]). I think it's time
to test it in some real cases, such as the TaoBao app.

[1] https://github.com/apache/incubator-weex/pull/960
[2] http://dotwe.org/vue/665a40b9ccc937025fceda627937f659
[3] http://dotwe.org/vue/5a182754bf404b314d70a4ced455c3e8

2017-12-19 16:47 GMT+08:00 Hanks Zhang <zh...@gmail.com>:

> For the Vue.js framework, I sent a PR [1] to achieve it. I think Rax
> should do the same thing.
>
> In the PR, I removed legacy framework APIs and use "createInstanceContext"
> instead of "createInstance" to create the Vue module instance for each page.
>
> Native render engines should also call "createInstanceContext" instead of
> "createInstance", and the source code is no longer needed. Another change
> is, the bundle type of the code (Vue or Rax) should be parsed in native and
> send it to js framework.
>
> [1] https://github.com/vuejs/vue/pull/7272
>
> 2017-12-04 16:22 GMT+08:00 Hanks Zhang <zh...@gmail.com>:
>
>> +1. Currently, multiple js bundles are executed in the same js context,
>> and the isolation is implemented by js, which is not robust.
>>
>> In my opinion, the most reasonable solution is to distinguish the "Global
>> Context" and the "Instance Context", move the logic of instance management
>> and code execution from js to native.
>>
>> On this basis, I think there are some sub-problems that need to be solved:
>>
>> (1). How to expose APIs from Global Context to Instance Context?
>> (2). How to isolate those exposed APIs?
>> (3). Adjustments of Vue and Rax.
>> (4). Impact on performance.
>> (5). What about the platform APIs and the polyfills? Such as console,
>> Object.assign, and timer.
>> (6). Redesign the js service.
>>
>> Feel free to discuss any of these topics, or add one.
>>
>> Best regards, Hanks
>>
>
>

Re: Use multi context for Weex page

Posted by Hanks Zhang <zh...@gmail.com>.
For the Vue.js framework, I sent a PR [1] to achieve it. I think Rax should
do the same thing.

In the PR, I removed legacy framework APIs and use "createInstanceContext"
instead of "createInstance" to create the Vue module instance for each page.

Native render engines should also call "createInstanceContext" instead of
"createInstance", and the source code is no longer needed. Another change
is, the bundle type of the code (Vue or Rax) should be parsed in native and
send it to js framework.

[1] https://github.com/vuejs/vue/pull/7272

2017-12-04 16:22 GMT+08:00 Hanks Zhang <zh...@gmail.com>:

> +1. Currently, multiple js bundles are executed in the same js context,
> and the isolation is implemented by js, which is not robust.
>
> In my opinion, the most reasonable solution is to distinguish the "Global
> Context" and the "Instance Context", move the logic of instance management
> and code execution from js to native.
>
> On this basis, I think there are some sub-problems that need to be solved:
>
> (1). How to expose APIs from Global Context to Instance Context?
> (2). How to isolate those exposed APIs?
> (3). Adjustments of Vue and Rax.
> (4). Impact on performance.
> (5). What about the platform APIs and the polyfills? Such as console,
> Object.assign, and timer.
> (6). Redesign the js service.
>
> Feel free to discuss any of these topics, or add one.
>
> Best regards, Hanks
>