You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by Bryce Curtis <cu...@gmail.com> on 2012/03/05 21:40:15 UTC

Plugin Initializations

I noticed that support for plugins delaying deviceready until they have
initialized themselves is no longer in cordova-js.  Does anyone remember if
there a specific reason why this wasn't carried forward, or if there's
another solution?

This is to support LocalStorage (cupcakeStorage) for some Android devices
that were missing it (not a large set of devices, if I recall).  However,
without it, there will be an error if cupcakeStorage if called too soon -
like in the deviceready callback.  It also seems like a feature that may be
needed for other types of plugins.

Regards,
Bryce

Re: Plugin Initializations

Posted by Filip Maj <fi...@adobe.com>.
FYI I added issue 299 to track this

https://issues.apache.org/jira/browse/CB-299


On 3/5/12 1:15 PM, "Johnny Ray" <jo...@johnnyray.me> wrote:

>You should be able to (via the js project) create a custom callback i.e.
>(onStorageReady) in channel.js, register that with bootstrap.js and
>deviceready will wait until it hears from you before it fires. I had to
>do the same thing just earlier today. Take a look:
>
>https://github.com/Johnny-Ray/incubator-cordova-js/commit/07307f8ab94e407b
>09ef57c9b1161741cd42e871
>
>-- 
>Johnny Ray
>http://johnnyray.me/
>
>
>On Monday, March 5, 2012 at 3:40 PM, Bryce Curtis wrote:
>
>> I noticed that support for plugins delaying deviceready until they have
>> initialized themselves is no longer in cordova-js. Does anyone remember
>>if
>> there a specific reason why this wasn't carried forward, or if there's
>> another solution?
>> 
>> This is to support LocalStorage (cupcakeStorage) for some Android
>>devices
>> that were missing it (not a large set of devices, if I recall). However,
>> without it, there will be an error if cupcakeStorage if called too soon
>>-
>> like in the deviceready callback. It also seems like a feature that may
>>be
>> needed for other types of plugins.
>> 
>> Regards,
>> Bryce
>> 
>> 
>
>


Re: Plugin Initializations

Posted by Filip Maj <fi...@adobe.com>.
Nice, thanks Johnny!

We can add a helper "plugin registration" method that runs through and
creates a channel and adds it to the device ready array of channels.

If that's in place, we should probably refactor the JS so that each
individual plugin calls for its own registration instead of hard-coding
certain channels in (like we do for device info and connection ready).

On 3/5/12 1:15 PM, "Johnny Ray" <jo...@johnnyray.me> wrote:

>You should be able to (via the js project) create a custom callback i.e.
>(onStorageReady) in channel.js, register that with bootstrap.js and
>deviceready will wait until it hears from you before it fires. I had to
>do the same thing just earlier today. Take a look:
>
>https://github.com/Johnny-Ray/incubator-cordova-js/commit/07307f8ab94e407b
>09ef57c9b1161741cd42e871
>
>-- 
>Johnny Ray
>http://johnnyray.me/
>
>
>On Monday, March 5, 2012 at 3:40 PM, Bryce Curtis wrote:
>
>> I noticed that support for plugins delaying deviceready until they have
>> initialized themselves is no longer in cordova-js. Does anyone remember
>>if
>> there a specific reason why this wasn't carried forward, or if there's
>> another solution?
>> 
>> This is to support LocalStorage (cupcakeStorage) for some Android
>>devices
>> that were missing it (not a large set of devices, if I recall). However,
>> without it, there will be an error if cupcakeStorage if called too soon
>>-
>> like in the deviceready callback. It also seems like a feature that may
>>be
>> needed for other types of plugins.
>> 
>> Regards,
>> Bryce
>> 
>> 
>
>


Re: Plugin Initializations

Posted by Johnny Ray <jo...@johnnyray.me>.
You should be able to (via the js project) create a custom callback i.e. (onStorageReady) in channel.js, register that with bootstrap.js and deviceready will wait until it hears from you before it fires. I had to do the same thing just earlier today. Take a look:

https://github.com/Johnny-Ray/incubator-cordova-js/commit/07307f8ab94e407b09ef57c9b1161741cd42e871 

-- 
Johnny Ray
http://johnnyray.me/


On Monday, March 5, 2012 at 3:40 PM, Bryce Curtis wrote:

> I noticed that support for plugins delaying deviceready until they have
> initialized themselves is no longer in cordova-js. Does anyone remember if
> there a specific reason why this wasn't carried forward, or if there's
> another solution?
> 
> This is to support LocalStorage (cupcakeStorage) for some Android devices
> that were missing it (not a large set of devices, if I recall). However,
> without it, there will be an error if cupcakeStorage if called too soon -
> like in the deviceready callback. It also seems like a feature that may be
> needed for other types of plugins.
> 
> Regards,
> Bryce
> 
> 



Re: Plugin Initializations

Posted by Filip Maj <fi...@adobe.com>.
Agreed. I don't think there's a reason, probably just overlooked.

I'll file an issue and we can start figuring out how to do it in JIRA. I
think the "Device Ready Channels array" object is in bootstrap.js - wire
into that seems like a good first step.

On 3/5/12 12:40 PM, "Bryce Curtis" <cu...@gmail.com> wrote:

>I noticed that support for plugins delaying deviceready until they have
>initialized themselves is no longer in cordova-js.  Does anyone remember
>if
>there a specific reason why this wasn't carried forward, or if there's
>another solution?
>
>This is to support LocalStorage (cupcakeStorage) for some Android devices
>that were missing it (not a large set of devices, if I recall).  However,
>without it, there will be an error if cupcakeStorage if called too soon -
>like in the deviceready callback.  It also seems like a feature that may
>be
>needed for other types of plugins.
>
>Regards,
>Bryce