Skip to content

sdgluck/mini-defer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mini-defer

Tiny module for creating a deferred with no polyfilling

Made with ❤ at @outlandish

npm version js-standard-style

Install

npm install mini-defer --save

Exported using UMD pattern, otherwise available on window as miniDefer.

Usage

defer() : Object

Create a deferred.

Example

function operation ()
  const deferred = defer()
  const eventBasedOperation = doOperation()

  eventBasedOperation.onsuccess = deferred.resolve
  eventBasedOperation.onerror = deferred.reject

  return deferred.promise
}

Contributing

All pull requests and issues welcome!

If you're not sure how, check out Kent C. Dodds' great video tutorials on egghead.io!

About

🎉 Tiny module for creating a deferred with no polyfilling

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published