Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8532549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:44:27+00:00 2026-06-11T09:44:27+00:00

Is there something I need to take into account about the plugin instance lifetime,

  • 0

Is there something I need to take into account about the plugin instance lifetime, or can I assume that this object exists all the time my web view is visible?

It seems from looking at a few plugins, some people tend to use some kind of singleton manager to store data in their PhoneGap plugins. Why not just store it in the PhoneGap plugin itself?

The reason for asking is that it seems the only proper way to communicate with the web view is through the [self writeJavaScript:message] method. If I register myself to receive some notification, I want to be sure my plugin instance exist.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T09:44:28+00:00Added an answer on June 11, 2026 at 9:44 am

    The plugin lives as long as the web view is alive.

    The proper way to initialize variables or register for callbacks is in the

    - (CDVPlugin*) initWithWebView:(UIWebView*)theWebView {
       self = [super initWithWebView:theWebView];
       if (self) {
           _variable = [[Variable alloc] init]; 
           [Classname addListener:self];
       }
       return self;
    }
    

    method. That method is run for all plugins.

    Don’t forget to clean up after yourself in the dealloc method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

there is something that I miss about the cc-NUMA architecture and the need to
Are there any programming methodologies that take into account the concept that the first
Potentially embarrassing question, but there is obviously something I'm missing that I want/need to
Jboss 4.2.0A Is there a /server directory that I need to change or something?
I need something like a temporary in-memory key-value store. I know there are solutions
Is there a URL encoding function in XSLT version 1? I need something similar
Are there any libraries for animation groups of objects in as3? I need something
So there is record.new_record? To check if something is new I need to check
Is there something in EF 4.1 that allows for a reconnect to a database
Is there something new about row-level security in SQL Server 2012? In 2008 and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.