than
Make everything asynchronous !
Last updated 12 years ago by javascript .
MIT · Original npm · Tarball · package.json
$ npm install than 
SYNC missed versions from official npm registry.

Than

Make your functions asynchronous by using the than function !!!

Installation

Use the npm command

npm install than

Usage

This package adds a prototype to Function, to use it, you need first to require it :

require('than');

Example

Here is an example showing you how this than function can be used

Let's say you have a function with blocking code

function calculate(a, b) {
    /*
        Your code that might take too long to execute !
     */

    return a + b;
}

So, instead of calling the function directly by passing two arguments, you can pass these arguments to the than function and a callBack that receives the result of the main function.

console.log("Do something");

calculate.than(1, 2, function(result) {
    console.log("Then display the result : ", result);
});

console.log("Do other thing");

If the calculate function takes too long to finish its execution, the output of the code above would be :

Do something
Do other thing
Then display the result : 3

Current Tags

  • 0.0.8                                ...           latest (12 years ago)

9 Versions

  • 0.0.8                                ...           12 years ago
  • 0.0.7                                ...           12 years ago
  • 0.0.6                                ...           12 years ago
  • 0.0.5                                ...           12 years ago
  • 0.0.4                                ...           12 years ago
  • 0.0.3                                ...           12 years ago
  • 0.0.2                                ...           12 years ago
  • 0.0.1                                ...           12 years ago
  • 0.0.0                                ...           12 years ago
Maintainers (1)
Downloads
Total 41
Today 0
This Week 3
This Month 32
Last Day 1
Last Week 11
Last Month 9
Dependencies (0)
None
Dev Dependencies (0)
None
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE