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

  • Home
  • SEARCH
  • 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 6371337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:03:08+00:00 2026-05-25T01:03:08+00:00

Here is my most simple code: var this_version =null; this.timervar = setTimeout(function () {

  • 0

Here is my most simple code:

var this_version =null;

this.timervar = setTimeout(function () {
    try {
        // Firefox 4 and later; Mozilla 2 and later
        Components.utils.import("resource://gre/modules/AddonManager.jsm");
        AddonManager.getAddonByID("parasites@maafire.com", function(addon) {
            this_version = addon.version;
            alert("r "+this_version);
        });
    } catch (ex) {
        // Firefox 3.6 and before; Mozilla 1.9.2 and before
        var em = Components.classes["@mozilla.org/extensions/manager;1"]
            .getService(Components.interfaces.nsIExtensionManager);
        var addon = em.getItemForID("parasites@maafire.com");
        this_version = addon.version;
        alert("rr " + this_version);
    }
    alert("rrr " + this_version);
}, 2000);

and its so damn strange because this fires twice alert("r "+this_version); but this alert("rrr "+this_version); always gives me null ;(

Still learning JS , so this is pretty puzzling… please help!

Thanks!

  • 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-05-25T01:03:10+00:00Added an answer on May 25, 2026 at 1:03 am

    Ok, solved it by just moving all the stuff except for the alert out of the timer:

    var this_version =null;
    try {
        // Firefox 4 and later; Mozilla 2 and later
        Components.utils.import("resource://gre/modules/AddonManager.jsm");
        AddonManager.getAddonByID("parasites@maafire.com", function(addon) {
            this_version = addon.version;
            alert("r "+this_version);
        });
    } catch (ex) {
        // Firefox 3.6 and before; Mozilla 1.9.2 and before
        var em = Components.classes["@mozilla.org/extensions/manager;1"]
            .getService(Components.interfaces.nsIExtensionManager);
        var addon = em.getItemForID("parasites@maafire.com");
        this_version = addon.version;
        alert("rr " + this_version);
    }
    
    this.timervar = setTimeout(function ()
                                { 
    
    
    
                                        alert("rrr "+this_version);
    
    
                                }, 2000);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have gone through most of the code here and tried several ways to
I am having trouble with the most simple piece of code. For some reason,
Here is some simple code that takes the id values of .somedivs and puts
function xmlParser(xml, projectName) { var currentIndex = 0; $(xml).find('entry').each(function(){ if($(this).attr('projectName').toLowerCase() == projectName) { $previous
Like most developers here and in the entire world, I have been developing software
I think most people here understand the importance of fully automated builds. The problem
I tend to get the feeling that most folks here think SVN is gold-plated
I think most C++ programmers here would agree that polluting the global namespace is
Most solutions I've read here for supporting subdomain-per-user at the DNS level are to
Here's a quicky question. Which method name makes the most sense for an Objective-C

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.