1.0.1 • Published 7 years ago

defer-class v1.0.1

Weekly downloads
5
License
BSD-3-Clause
Repository
github
Last release
7 years ago

defer-class

Deferred Promises as a Class

Basically Q.defer() using native constructs

Install

npm install --save defer-class

Usage

const Defer = require('defer-class')

const deferred = new Defer

deferred.promise.then(result => console.log(result))

deferred.resolve('Hello World')
// Logs 'Hello World'

API

new Defer

Creates a new deferred promise with the following interface:

#resolve(data)

Resolves the promise with the given data

#reject(error)

Rejects the promise with the given data

#promise

The underlying promise object, used for chaining & such

1.0.1

7 years ago

1.0.0

7 years ago