Are scripts single-instance?

Are scripts single-instance?

]]>

12 Commentsto Are scripts single-instance?

  1. Anonymous says:

    < ![CDATA[

    I don’t think so.


    I have a script with a timeout function after some seconds (they are considered part of the script itself, right? ). I launch the script from the tap function of an item, and I can have as much functions ‘waiting’ as I want (don’t know the limit if there is one)

    ]]>

  2. Anonymous says:

    < ![CDATA[

    I have set a script to positionchanged event and build a check if already an instance is running. If yes write something to logfile. This never happens

    ]]>

  3. Anonymous says:

    < ![CDATA[

    The position changed event is called when the previous one finish….I think.


    Try to put it with timeout functions…maybe they work

    ]]>

  4. Anonymous says:

    < ![CDATA[

    Somehow setTimeout seems to be just ignored… Everything is done instantly

    ]]>

  5. Anonymous says:

    < ![CDATA[

    Well, depend on how are you checking it. I know some functions that returns the parameter they had when the script was launched, even if it is run minutes after with settimeout.


    How are you checking it?

    ]]>

  6. Anonymous says:

    < ![CDATA[

    var doIt=function()


    {


    LL.setScriptTag(parseInt(LL.getScriptTag())-1);


    LL.writeToLogFile(LL.getScriptTag()+”\n”,true);


    }



    var tag=LL.getScriptTag()||null;


    if(tag==null){


    LL.writeToLogFile(“start\n”,false);


    tag=”0″;


    }


    LL.setScriptTag(parseInt(tag)+1);


    LL.writeToLogFile(LL.getScriptTag()+”\n”,true);


    setTimeout(doIt(),1000);


    ]]>

  7. Anonymous says:

    < ![CDATA[

    Hm, do it work if you launch it from a shortcut and you click it very fast? 



    Edit: the ‘or’ operator || in this sentence


    Ll.getScriptTag() || default;



    Is used to set a default value when the left part is null, so


    LL.getScriptTag() || null;


    Is exactly the same as


    LL.getScriptTag()



    😉

    ]]>

  8. Anonymous says:

    < ![CDATA[

    I’ll try

    ]]>

  9. Anonymous says:

    < ![CDATA[

    Still 0101010101010…

    ]]>

  10. Anonymous says:

    < ![CDATA[

    Wait a moment


    Of course it is not doing the timeout, because it takes a function, not the output of a function.


    I mean:


    setTimeout(dolt(),1000)


    is evaluating the dolt function, and then the setTimeout is doing the output: null


    You need



    setTimeout(dolt,1000)

    ]]>

  11. Anonymous says:

    < ![CDATA[

    Lukas Morawietz I finished editing my comments. Check them all (sorry for the editing)

    ]]>

  12. Anonymous says:

    < ![CDATA[

    Scripts are run sequentially, one at a time but can possibly be interleaved if one is paused (a dialog box).


    When setting a timeout, the function is called later and holds a reference on local variables, hence it is safe.


    There isn’t really a notion of instance of a script. Instead there are data (possibly shared through the root object) and there is code execution. Code execution is always sequential, but may be run partly.

    ]]>

Leave a Reply

Your email address will not be published. Required fields are marked *