[Project_owners] how to initial some variables

eric.jung at yahoo.com eric.jung at yahoo.com
Tue Jan 23 07:29:02 PST 2007


#2 is whatever code you need to execute once and only once. For instance, welcoming the user to your extension or basic instructions on how to use it. The way to determine if #2 executes is through #1... check for the existence of a custom preference. Its non-existence indicates your extension has never executed before. Its existence indicates your extension *has* executed before.


----- Original Message ----
From: Amin <amin.eft at gmail.com>
To: Mozdev Project Owners List <project_owners at mozdev.org>
Sent: Tuesday, January 23, 2007 12:39:36 AM
Subject: Re: [Project_owners] how to initial some variables

eric would you please tell me more about line 2 : 'Execute "run this code only at first install" code'
how my extension find that it is first time or not ?


On 1/23/07, 
eric.jung at yahoo.com <eric.jung at yahoo.com> wrote:
1. Does the extensions.myextension.firstrun preference exist? If yes, goto 4. If no, goto 2.

2. Execute "run this code only at first install" code
3. Write the extensions.myextension.firstrun preference
4. Continue with other startup (non-firstrun) code.



----- Original Message ----
From: Amin <
amin.eft at gmail.com>
To: Mozdev Project Owners List <project_owners at mozdev.org>
Sent: Monday, January 22, 2007 3:41:16 PM

Subject: Re: [Project_owners] how to initial some variables

i exacly men 'RUN ONLY THIS CODE AT FIRST INSTALL'

On 1/22/07, Nickolay Ponomarev
 <asqueella at gmail.com
> wrote:On 1/21/07, Amin <
amin.eft at gmail.com
> wrote:
> i have some variable in my extension , i want to set them first time after
> instalation
>
>     var prefs =
> Components.classes["@

mozilla.org/preferences-service;1
> "].getService(Components.interfaces.nsIPrefService).getBranch("
amin.eft_PhProxy at gmail.com");
>         prefs.setCharPref
(id, sData);
>
>
>
> where i must put code like this to set them only one time ?
>
Do you mean preferences? Why don't you use default preferences?


http://developer.mozilla.org/en/docs/Code_snippets:Preferences#Default_preferences

Nickolay
_______________________________________________
Project_owners mailing list


Project_owners at mozdev.org
http://mozdev.org/mailman/listinfo/project_owners




_______________________________________________
Project_owners mailing list
Project_owners at mozdev.org

http://mozdev.org/mailman/listinfo/project_owners










_______________________________________________
Project_owners mailing list
Project_owners at mozdev.org

http://mozdev.org/mailman/listinfo/project_owners





_______________________________________________
Project_owners mailing list
Project_owners at mozdev.org
http://mozdev.org/mailman/listinfo/project_owners




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mozdev.org/pipermail/project_owners/attachments/20070123/9b665a19/attachment.html 


More information about the Project_owners mailing list