Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    async-functionspublic

    async-functions

    A simple, clean way of calling functions asynchronously

    Install

    $ npm install async-functions

    Usage

    require('async-functions');
     
    var foo = function(a, b) {
        console.log(+ b);
    }
     
    foo.async(1, 2);  // Logs "3", but async! 
     
    var bar = function(a, b) {
        console.log(this.baz);
        console.log(+ b);
    };
     
    var scope = { baz: 'Hello!' };
     
    bar.bind(scope).async(1, 2);  // Logs "Hello!" and then "3" 
     
    // Also works in the .apply style 
    foo.asyncApply([1, 2])

    How does it work?

    How do you think..? I modified the Function prototype. Yes, I know, I'm going to hell..

    License

    None. Public Domain.

    Keywords

    none

    install

    npm i async-functions

    Downloadslast 7 days

    1

    version

    0.0.2

    license

    none

    repository

    github.com

    last publish

    collaborators

    • avatar