mumford

0.2.1 • Public • Published

mumford Build Status npm version devDependency Status

I will wait

when().then()

Pass when a function, once it returns true, the then function will be resolved.

when can be chained and will run synchronously.

when(condition).then(function() {
    // do something
})
.when(somethingElse).then(function() {
    // you can chain when synchronously
});

doUntil().then()

Pass doUntil a function that takes a parameter next, an async function can then be executed, calling next in it's own callback. If next is passed true, it will run again. Passing false will resolve the then function.

doUntil(function (next) {
    var item = input.shift();
    someAsyncFunction(function() {
        next(true); // passing false will resolve then()
    });
}).then(function() {
    // do something after
});

License

MIT License

Package Sidebar

Install

npm i mumford

Weekly Downloads

11

Version

0.2.1

License

none

Last publish

Collaborators

  • leecrossley