avar

0.0.1 • Public • Published

avar

Asyncronous variables

Installation

Install with npm

$ npm install avar

or

$ npm install jb55/avar

Example

var avar = require('avar')
 
function query(done) {
  setTimeout(function() {
    done(null, 2);
  }, 1000);
}
 
// query is called is its resulting arguments are cached for future `get`s
var example = avar(query);
 
example.get(function (err, data) {
  // will get called when done, subsequent calls to get retrieve
  // cached arguments
});
 
setTimeout(function () {
  example.get(function (err, data) {
    // err and data were retrieved from cache
  });
}, 2000);

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i avar

Weekly Downloads

1

Version

0.0.1

License

none

Last publish

Collaborators

  • jb55