Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

underscore.deferred

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

underscore.deferred

Underscore style Deferreds

  • 0.1.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
51K
increased by5.6%
Maintainers
1
Weekly downloads
 
Created
Source

Underscore.Deferred

v0.1.2

This is a port of jQuery.Deferred as an Underscore mixin, but it can be used without any depencencies. It currently matches the Deferred specifications and implementation from jQuery 1.7.1, with all the associated helpers.

Contributors

  • rwldrn
  • tbranyen
  • taxillian

Deferred's are great, let's take them everywhere

jQuery offers a robust, consistent and well documented API; this project aims to make it portable. jQuery added a handful of helper methods to their implementation of the Common.js Promise Spec, and they're faithfully reproduced without any dependencies.

Underscore.Deferred supports the following methods:

  • done
  • resolve
  • isResolved
  • then
  • always
  • fail
  • reject
  • isRejected
  • pipe
  • promise

For specific API documentation, look to the jQuery Docs.

Build

One time setup command:

$ npm install

To build with grunt

$ node build

To run headless Qunit tests (must have phantomjs in your path)

$ node build test

Usage

Underscore.Deferred works on the server and in the browser.

In the browser, just require it like you would any other file. If you're including Underscore on the page, make sure you include it before Underscore.Deferred. If you don't have Underscore, the plugin attaches to window._.

Addionally, underscore.Deferred can be used with the Ender.js build tool, if you're into that sort of thing.

On the server, simply install via npm and require normally. If you'd like to use it as an Underscore module, just do this:

var _ = require('underscore')._
_.mixin( require('underscore.deferred') );

But keep in mind the Underscore is not a strict requirement, and assigning it to another namespace will always work.

Roadmap

The goal is to slim the code footprint for robust deferreds as much as possible while maintaining mixin integration with Underscore and faithfullness to the jQuery API.

This is a work in progress, feel free to contribute.

MIT License.

FAQs

Package last updated on 12 Feb 2012

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc