Skip to content

memoize() for async function but without ability to pass arguments

Notifications You must be signed in to change notification settings

eldargab/async-memo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#async-memo

Call a function at most once and remember the result. Args are not supported.

##Example

var memo = require('async-memo')
var doc = memo(function(cb) {
  // fetch remote document
  // you want this to be done only once
  fetch(cb)
})
doc(function(err, val) {
  // use fetched document here
})
// You can safely call doc() from everywhere at any time.
// fetch() will be called only once.

##Installation

via component

component install eldargab/async-memo

via npm

npm install async-memo

##License

MIT

About

memoize() for async function but without ability to pass arguments

Resources

Stars

Watchers

Forks

Packages