Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Load order of userscripts

Is it possible to somehow influence the order the userscripts are loaded. I have a userscript which depends on another.

I tried naming the userscript files in the alphabetical order I need them to be loaded but that did not help.

Any ideas?

Thanks

Rob

— asked March 30th 2010 by Robert Schmidt
0 Comments

3 Answers

  • try to add an eventlistener with a load function. Im not sure this will work, biut its worth giving it a try.

    e.g.

    function loadScript1() {
    // do stuff
    }
    
    function loadScript2() {
    // do stuff
    }
    
    function loadScript3() {
    // do stuff
    }
    
    loadScript1();
    
    loadScript1.addEventListener('load', function() {
      loadscript2();
    });
    
    loadScript2.addEventListener('load', function() {
    loadScript3();
    });
    
    — answered March 30th 2010 by Glenn Tillemans
    permalink
    0 Comments
  • I will give it a try. Thanks.

    — answered March 30th 2010 by Robert Schmidt
    permalink
    0 Comments
  • Using functions and appropriate listeners to call the function at your designated moment may help.

    Approach:

    Encapsulate related actions into functions.
    Call only when necessary.

    Note: Make sure your variables are global (outside functions) if you want to use them in other places…

    — answered March 30th 2010 by Peter Lum
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.