Joined May 2011
·

Nicolas Perriault

Funky Web Architect at scopyleft
·
Montpellier, France
·
·
·

Posted to End to End Testing with CasperJS over 1 year ago

You should avoid waiting for an arbitrary amount of milliseconds for processing a next step, rather use waitFor* methods as they're more deterministic :)

Posted to Sublime Text 2 - quick full screen over 1 year ago

Thanks!

@dperrymorrow thanks!

PS: you've fixed it as "CapserJS" ;)

s/CaserJS/CasperJS :)

Posted to Promise Chains with Node.js over 1 year ago

You're welcome :) Now I'm looking back at the resulting code, I wonder if using map() wouldn't be even more concise:

function get_all_the_things(things) {
    return Q.all(things.map(function(thing) {
        var deferred = Q.defer();
        get_a_thing(thing, function(result) {
            deferred.resolve(result);
        });
        return deferred.promise;
    }));
}
Posted to Promise Chains with Node.js over 1 year ago

Very nice post. As a side note, instead of writing loops like:

for (var i = 0; i < async_operations.length; i++) {
    (function(i) {
        //...
    })(i);
});

You should consider using forEach instead:

async_operations.forEach(function(op) {
     //...
});
Achievements
221 Karma
2,203 Total ProTip Views