cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Bowser <bows...@gmail.com>
Subject Re: Proposal for JS in Plugins
Date Wed, 06 Feb 2013 23:27:51 GMT
I also disagree with automagically injecting the script tags.  If
we're adding the script tags, we have the ability of adding the script
tags wrong, and breaking people's apps with magic.  We have enough
trouble directing our users to use Cordova/PhoneGap without us trying
to make things more clever.

On Wed, Feb 6, 2013 at 2:39 PM, Anis KADRI <anis.kadri@gmail.com> wrote:
> I don't think we should be automatically injecting javascript tags.
> Instruct users to do so when they add a plugin by displaying the tag.
> Everyone has different needs/requirements.
>
> Also
>
> *"cordova plugin add file"
> - Download plugin files to project/plugins
> - Runs plugman to install native parts of the plugin.
> - Plugman will copy JS files listed into
> project/platforms/cordova-js/lib/...*
> * *
> *plugman supports installation by local-dir/git-repo/name. Names are
> listed/stored on an outside source. So I believe this step should just call
> plugman with the name/git/local-dir. We've already agreed that all plugins
> will have separate repositories, yes ?*
> *
> *
> *I also agree that plugin.xml should support dependencies and that we
> should update the plugin spec. **I like the requires-plugin tag but I am
> not sure I like that js-symbols tag in plugin.xml though. **I am confused
> about that "Exporting Module Symbols" section. An example would be
> appreciated.*
> *
> *
> *Anis*
>
>
> On Wed, Feb 6, 2013 at 12:45 PM, Braden Shepherdson <braden@chromium.org>wrote:
>
>> I think it's fine to have the default behavior be to inject script tags.
>> That will suffice for 90% of our users, probably more. If you fall into the
>> 10% that have some more complicated setup, we should provide a flag like
>> > cordova plugin add --no-inject-js myplugin
>> that prevents us from doing it automatically, and you can do whatever more
>> complex step you need to do.
>>
>>
>> Braden
>>
>>
>> On Wed, Feb 6, 2013 at 3:37 PM, Andrew Grieve <agrieve@chromium.org>
>> wrote:
>>
>> > On Wed, Feb 6, 2013 at 3:00 PM, Filip Maj <fil@adobe.com> wrote:
>> >
>> > >
>> > >
>> > > On 2/6/13 11:51 AM, "Andrew Grieve" <agrieve@chromium.org> wrote:
>> > >
>> > > >On Wed, Feb 6, 2013 at 2:33 PM, Filip Maj <fil@adobe.com> wrote:
>> > > >
>> > > >> I've added a few detail explanations to the document, but moved
the
>> > > >> discussion to the ML.
>> > > >>
>> > > >> ----
>> > > >>
>> > > >> > Should be easy to install / remove plugins (no need to manually
>> > > >> >add/remove script tags)
>> > > >>
>> > > >>
>> > > >> I think adding/removing script tags is the way to go. Concatenating
>> > all
>> > > >> javascript relevant to your project (cordova.js + any plugins
you
>> add)
>> > > >> makes it difficult to debug later on. WE'd have to get users to
post
>> > > >> entire contents of their cordova.js file to determine what was
added
>> > and
>> > > >> what exists in there. With that in mind, I favor the packager
>> > approach,
>> > > >> which would require:
>> > > >>
>> > > >
>> > > >Very good point about concat making it hard to track bugs! I wonder
if
>> > > >there's a better way than requiring users to manually add the tags
(we
>> > > >don't require them to manually add native files to their project
>> files).
>> > > >
>> > > >One thought is to have cordova-packer output source-maps. I don't
>> think
>> > > >there's very good support for them in mobile browsers yet, but we
>> could
>> > > >use
>> > > >them to manually map exception line numbers to file+line numbers.
>> > > >
>> > > >Another idea is to use exec + special comment that is used in our
>> > existing
>> > > >pkg/debug/*.js files. I don't think support for this is all that great
>> > > >either though.
>> > > >
>> > > >Another idea is to have cordova.js inject a script tag for each
>> module.
>> > > >This may have an adverse effect on start-up time, but probably no
>> worse
>> > > >than if the user manually adds all of the script tags separately.
>> > Winner?
>> > >
>> > > I don't think the script tag is a giant issue, but I do think it is a
>> > > slipper slope problem to try and solve. What if the user has a
>> multipage
>> > > application? Do we then add script tags automatically to all pages?
>> What
>> > > if the user only uses the plugin on specific pages? Etc etc
>> > >
>> >
>> > I'm suggesting that any page that include (manually) cordova.js will have
>> > it dynamically inject installed plugin JS files. Should work fine in a
>> > multi-page app. We don't currently disable plugins on a per-page basis.
>> Is
>> > this really an important use-case? If so, I'm sure we could figure out
>> how
>> > to not inject script tags for plugins you don't want.
>> >
>>

Mime
View raw message