cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Grieve <agri...@chromium.org>
Subject Re: CDVPlugins and Designated Initializers
Date Thu, 14 Feb 2013 19:54:49 GMT
Hmm, yeah, I didn't notice this on the first pass, but the settings
parameter refers to plugin-specific settings. This is always nil, and was
probably broken when we moved to an xml file for config. None of our core
plugins use it, so I'll just delete it at this point.

pluginInitialize sounds fine to me :)


On Thu, Feb 14, 2013 at 2:29 PM, Shazron <shazron@gmail.com> wrote:

> I doubt any plugins use the initWithWebView:settings: selector at all,
> might be legacy stuff in there that needs to be weeded out.
> Let's deprecate them and use two-phase initialization. pluginDidInitialize
> to me implies a notification-like method, how about pluginInitialize
>
>
> On Thu, Feb 14, 2013 at 10:09 AM, Andrew Grieve <agrieve@chromium.org
> >wrote:
>
> > The iOS plugin guide doesn't mention init methods for plugins. We should
> > fix this...
> >
> > But first, how...
> >
> > Right now we have:
> >
> > - (CDVPlugin*)initWithWebView:(UIWebView*)theWebView
> > > settings:(NSDictionary*)classSettings
> > > {
> > >     self = [self initWithWebView:theWebView];
> > >     if (self) {
> > >         self.settings = classSettings;
> > >         self.hasPendingOperation = NO;
> > >     }
> > >     return self;
> > > }
> > > - (CDVPlugin*)initWithWebView:(UIWebView*)theWebView
> > > {
> > >     self = [super init];
> > >     ...
> >
> >
> > So... Looks like initWithWebView: is the designated initializer, but the
> > plugin doesn't get it's settings set until after it returns. Also,
> > self.viewController and self.commandDelegate get set after the
> initializer
> > altogether.
> >
> > In Android, we use two-step initialization:
> >
> >                 this.plugin = (CordovaPlugin) c.newInstance();
> > >                 this.plugin.initialize(ctx, webView);
> >
> > We can't remove either initializer without breaking compatibility, but
> > maybe we could deprecate them?
> >
> > I think it also makes sense to use two-phase initialization on iOS.
> Perhaps
> > "pluginDidInitialize".
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message