Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing the same variable in multiple parts of a Firefox extension

In the Firefox extension I'm writing, I have a variable containing some data that I want to be able to access in both the actual extension and in the preferences pane of the extension. When Firefox is loaded, my extension code initializes the variable with the correct data. But, when I bring up my options dialog (which is contained in another XUL file) and try to use that same variable, the variable hasn't been initialized. Both of my extension XUL files are using the same JavaScript source file, but it looks like both XUL files are initializing new copies of the variable. How can I get that variable to be shared?

Thanks!

like image 841
Scott Avatar asked Nov 16 '25 07:11

Scott


1 Answers

You will want to create a JavaScript code module. All the variables and methods inside of it are shared by all locations that include it.

like image 107
sdwilsh Avatar answered Nov 18 '25 20:11

sdwilsh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!