defer

Defer execution of a task.

  • defer

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
defer
1.0.06 years ago13 years agoMinified + gzip package size for defer in KB

Readme

Defer
Defer execution of a task.

Installation

npm install --save defer

Usage

const defer = require('defer')

async function signup (input) {
  // create user

  defer(async () => {
    // send welcome email
  })

  return user
}

API

defer(fn): Promise

Returns a Promise that will resolve with the return value of fn. The function fn will be invoked at a later stage in the event loop.