incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shazron <shaz...@gmail.com>
Subject Plugin loading - on startup and on demand
Date Wed, 06 Jun 2012 21:01:00 GMT
How are plugins loaded in the other platforms?

Right now in iOS, a plugin is lazily loaded, that is - it is loaded
only on first time use. There is a case for loading plugins at startup
- like my iOS 5.1 local storage fix (CDVLocalStorage). Right now that
plugin is hard-coded to load at startup, but I would like there to be
a general plugin loading at startup feature in Cordova (at least iOS).

In iOS, we have the "Plugins" key in Cordova.plist. Unfortunately - we
can't just add a checkbox to the list since it's an Array. What I'm
proposing (as a quick thing) is to add another Array in Cordova.plist
for plugins that should be loaded at startup, say, a key called
"Startup".

The alternative is to change the "Plugins" Array of Strings to a
Dictionary - then the Dictionary key will be the plugin Name and the
Dictionary value would be a boolean saying whether it should be loaded
at startup. But I tried it in Xcode, and the checkbox could be
confused with whether the plugin is "enabled" or not.

Yet another alternative is to change the "Plugins" Array of Strings to
a "Plugins" Array of Dictionaries. Each dictionary would have two
keys: "Name" (String), and "LoadOnStartup" (Boolean). Then it won't be
ambiguous.

Having a separate "Startup" list would be advantageous:

    1. We don't have to make users upgrade their Cordova.plist/Plugins
(backwards compatibility)
    2. It is unambiguous what it is for (vs the changing
Cordova.plist/Plugins to a Dictionary)

Mime
View raw message