You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@weex.apache.org by jiyinyiyong <ji...@gmail.com> on 2017/03/10 09:12:17 UTC

Intend to update Vanilla framework with the Vue version

### Problem

The current implementation of Vanilla framework is quit old:
https://github.com/apache/incubator-weex/blob/master/html5/frameworks/vanilla/index.js#L69

and it lacks some features provided in Weex in newer versions:
requireModule, global `weex` variable. Also it exposed `id` `options`
variables to the global scope which makes scripting apps with Vanilla
framework not as safe.

### Proposed solution

Since I don't know every detail of how Weex works, I think reusing code
from Vue is much easier. By removing Vue related code I got a first version
that's workable
https://gist.github.com/jiyinyiyong/39b8e319b7078dd613f7e5b0c7191369 which
is based on
https://github.com/vuejs/vue/blob/dev/src/platforms/weex/framework.js .

Higher level features of js framework is documented at
http://weex.apache.org/references/advanced/extend-jsfm.html but I still got
some confusions, a new function `reset` is added, while `prepareInstance`
`registerMethods` are removed in the Vue code.

Just need to to confirm the details since I just simply removed Vue-related
code to get the first version.

### Benefit

In Eleme(github id: eleme) we are experimenting Weex online, and some of
our code are `*.js` files which does analytics works. A Vanilla Weex
environment would easily simplify our development of small libraries that
are not related to Vue or any other framework. I think that bring
convenience to others to.

And personally I think it brings more help to people who want to use other
self-created frameworks. However, currently I'm the only one I know who
want to do it for real. Also by offering such a framework, it can be
helpful in debugging too since we can be sure less code is involved.

Re: Intend to update Vanilla framework with the Vue version

Posted by jiyinyiyong <ji...@gmail.com>.
I updated that Gist. Din't noticed that I removed code for
`instances[instanceId] =`, now they are back.

What do you think about normalize? Can I import them if that's already
provided?

On Fri, Mar 10, 2017 at 6:46 PM Hanks Zhang <zh...@gmail.com> wrote:

> Thanks for doing this.
>
> The code in the gist [1] might be able to execute the js bundle, but still
> need some modifications. The "normalize" method should move to Weex
> runtime. The "instances" object seems to have no chance to contain the
> instance, and the callback may not works well.
>
> Moreover, the Vanilla framework contains many low level APIs which could be
> modified often. As far as I know, no one used it in production yet.
>
> Suggest you use Vue.js [2] and Rax [3] to write Weex application.
>
> -----------
>
> [1] https://gist.github.com/jiyinyiyong/39b8e319b7078dd613f7e5b0c7191369
> [2] https://vuejs.org/
> [3] https://github.com/alibaba/rax
>
> -----------
>
> Hanks
>
> 2017-03-10 17:12 GMT+08:00 jiyinyiyong <ji...@gmail.com>:
>
> > ### Problem
> >
> > The current implementation of Vanilla framework is quit old:
> > https://github.com/apache/incubator-weex/blob/master/
> > html5/frameworks/vanilla/index.js#L69
> >
> > and it lacks some features provided in Weex in newer versions:
> > requireModule, global `weex` variable. Also it exposed `id` `options`
> > variables to the global scope which makes scripting apps with Vanilla
> > framework not as safe.
> >
> > ### Proposed solution
> >
> > Since I don't know every detail of how Weex works, I think reusing code
> > from Vue is much easier. By removing Vue related code I got a first
> version
> > that's workable
> > https://gist.github.com/jiyinyiyong/39b8e319b7078dd613f7e5b0c7191369
> which
> > is based on
> > https://github.com/vuejs/vue/blob/dev/src/platforms/weex/framework.js .
> >
> > Higher level features of js framework is documented at
> > http://weex.apache.org/references/advanced/extend-jsfm.html but I still
> > got
> > some confusions, a new function `reset` is added, while `prepareInstance`
> > `registerMethods` are removed in the Vue code.
> >
> > Just need to to confirm the details since I just simply removed
> Vue-related
> > code to get the first version.
> >
> > ### Benefit
> >
> > In Eleme(github id: eleme) we are experimenting Weex online, and some of
> > our code are `*.js` files which does analytics works. A Vanilla Weex
> > environment would easily simplify our development of small libraries that
> > are not related to Vue or any other framework. I think that bring
> > convenience to others to.
> >
> > And personally I think it brings more help to people who want to use
> other
> > self-created frameworks. However, currently I'm the only one I know who
> > want to do it for real. Also by offering such a framework, it can be
> > helpful in debugging too since we can be sure less code is involved.
> >
>

Re: Intend to update Vanilla framework with the Vue version

Posted by jiyinyiyong <ji...@gmail.com>.
Yeah, there's still things to do before I can send a PR.

We don't use Vanilla framework on production either. We only use it in
debugging and library developing.

Currently my colleagues are using Weex and have not checked out Rax yet.

On Fri, Mar 10, 2017 at 6:46 PM Hanks Zhang <zh...@gmail.com> wrote:

> Thanks for doing this.
>
> The code in the gist [1] might be able to execute the js bundle, but still
> need some modifications. The "normalize" method should move to Weex
> runtime. The "instances" object seems to have no chance to contain the
> instance, and the callback may not works well.
>
> Moreover, the Vanilla framework contains many low level APIs which could be
> modified often. As far as I know, no one used it in production yet.
>
> Suggest you use Vue.js [2] and Rax [3] to write Weex application.
>
> -----------
>
> [1] https://gist.github.com/jiyinyiyong/39b8e319b7078dd613f7e5b0c7191369
> [2] https://vuejs.org/
> [3] https://github.com/alibaba/rax
>
> -----------
>
> Hanks
>
> 2017-03-10 17:12 GMT+08:00 jiyinyiyong <ji...@gmail.com>:
>
> > ### Problem
> >
> > The current implementation of Vanilla framework is quit old:
> > https://github.com/apache/incubator-weex/blob/master/
> > html5/frameworks/vanilla/index.js#L69
> >
> > and it lacks some features provided in Weex in newer versions:
> > requireModule, global `weex` variable. Also it exposed `id` `options`
> > variables to the global scope which makes scripting apps with Vanilla
> > framework not as safe.
> >
> > ### Proposed solution
> >
> > Since I don't know every detail of how Weex works, I think reusing code
> > from Vue is much easier. By removing Vue related code I got a first
> version
> > that's workable
> > https://gist.github.com/jiyinyiyong/39b8e319b7078dd613f7e5b0c7191369
> which
> > is based on
> > https://github.com/vuejs/vue/blob/dev/src/platforms/weex/framework.js .
> >
> > Higher level features of js framework is documented at
> > http://weex.apache.org/references/advanced/extend-jsfm.html but I still
> > got
> > some confusions, a new function `reset` is added, while `prepareInstance`
> > `registerMethods` are removed in the Vue code.
> >
> > Just need to to confirm the details since I just simply removed
> Vue-related
> > code to get the first version.
> >
> > ### Benefit
> >
> > In Eleme(github id: eleme) we are experimenting Weex online, and some of
> > our code are `*.js` files which does analytics works. A Vanilla Weex
> > environment would easily simplify our development of small libraries that
> > are not related to Vue or any other framework. I think that bring
> > convenience to others to.
> >
> > And personally I think it brings more help to people who want to use
> other
> > self-created frameworks. However, currently I'm the only one I know who
> > want to do it for real. Also by offering such a framework, it can be
> > helpful in debugging too since we can be sure less code is involved.
> >
>

Re: Intend to update Vanilla framework with the Vue version

Posted by Hanks Zhang <zh...@gmail.com>.
Thanks for doing this.

The code in the gist [1] might be able to execute the js bundle, but still
need some modifications. The "normalize" method should move to Weex
runtime. The "instances" object seems to have no chance to contain the
instance, and the callback may not works well.

Moreover, the Vanilla framework contains many low level APIs which could be
modified often. As far as I know, no one used it in production yet.

Suggest you use Vue.js [2] and Rax [3] to write Weex application.

-----------

[1] https://gist.github.com/jiyinyiyong/39b8e319b7078dd613f7e5b0c7191369
[2] https://vuejs.org/
[3] https://github.com/alibaba/rax

-----------

Hanks

2017-03-10 17:12 GMT+08:00 jiyinyiyong <ji...@gmail.com>:

> ### Problem
>
> The current implementation of Vanilla framework is quit old:
> https://github.com/apache/incubator-weex/blob/master/
> html5/frameworks/vanilla/index.js#L69
>
> and it lacks some features provided in Weex in newer versions:
> requireModule, global `weex` variable. Also it exposed `id` `options`
> variables to the global scope which makes scripting apps with Vanilla
> framework not as safe.
>
> ### Proposed solution
>
> Since I don't know every detail of how Weex works, I think reusing code
> from Vue is much easier. By removing Vue related code I got a first version
> that's workable
> https://gist.github.com/jiyinyiyong/39b8e319b7078dd613f7e5b0c7191369 which
> is based on
> https://github.com/vuejs/vue/blob/dev/src/platforms/weex/framework.js .
>
> Higher level features of js framework is documented at
> http://weex.apache.org/references/advanced/extend-jsfm.html but I still
> got
> some confusions, a new function `reset` is added, while `prepareInstance`
> `registerMethods` are removed in the Vue code.
>
> Just need to to confirm the details since I just simply removed Vue-related
> code to get the first version.
>
> ### Benefit
>
> In Eleme(github id: eleme) we are experimenting Weex online, and some of
> our code are `*.js` files which does analytics works. A Vanilla Weex
> environment would easily simplify our development of small libraries that
> are not related to Vue or any other framework. I think that bring
> convenience to others to.
>
> And personally I think it brings more help to people who want to use other
> self-created frameworks. However, currently I'm the only one I know who
> want to do it for real. Also by offering such a framework, it can be
> helpful in debugging too since we can be sure less code is involved.
>