Shaare your links…
408 links
Liens · Devenet Home Login RSS feed Tags cloud
  • 7 lines JavaScript library for calling asynchronous functions → http://krasimirtsonev.com/blog/article/7-lines-JavaScript-library-for-calling-asynchronous-functions
    M'ouais sinon y'a http://stackoverflow.com/questions/899102/how-do-i-store-javascript-functions-in-a-queue-for-them-to-be-executed-eventuall

    // Function wrapping code.
    // fn - reference to function.
    // context - what you want "this" to be.
    // params - array of parameters to pass to function.
    var wrapFunction = function(fn, context, params) {
       return function() {
           fn.apply(context, params);
       };
    }


    // Create my function to be wrapped
    var sayStuff = function(str) {
       alert(str);
    }

    // Wrap the function.  Make sure that the params are an array.
    var fun1 = wrapFunction(sayStuff, this, ["Hello, world!"]);
    var fun2 = wrapFunction(sayStuff, this, ["Goodbye, cruel world!"]);

    // Create an array and append your functions to them
    var funqueue = [];
    funqueue.push(fun1);
    funqueue.push(fun2);

    // Remove and execute all items in the array
    while (funqueue.length > 0) {
       (funqueue.shift())();  
    }
    Mon Apr 7 22:29:54 2014 – #permalink
    javascript ressource
Shaarli by sebsauvage
Shaarli-Theme by Nicolas based on idleman theme