Socket
Socket
Sign inDemoInstall

mini-defer

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    mini-defer

Tiny module for creating a deferred with no polyfilling


Version published
Weekly downloads
272
decreased by-47.89%
Maintainers
1
Install size
5.19 kB
Created
Weekly downloads
 

Readme

Source

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

ES6 Import (w/ Babel)

import defer from 'mini-defer'

CommonJS Require

var defer = require('mini-defer')

Script

<script src="/node_modules/mini-defer/index.js"></script>
typeof window.miniDefer //=> "Function"

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!

Keywords

FAQs

Last updated on 29 Feb 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc