hang
Force the supplied callback in to async execution
Last updated 10 years ago by 3rdeden .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install hang 
SYNC missed versions from official npm registry.

hang

Made by unshiftVersion npmBuild StatusDependenciesCoverage StatusIRC channel

hang is micro helper function that will guarantee that your callbacks are called async. The returned function can be called in sync or completely async. When it's called in sync we will "hang" execution in a setImmidiate or setTimeout(0) to ensure that it's called in async.

Installation

The module is released in the public npm registry and can be installed by running:

npm install --save hang

Usage

Require the module and supply it the function that should be called in completely async:

'use strict';

var hang = require('hang');

var fn = hang(function (foo) {
  console.log(this, foo); // foo, bar
});

fn.call('foo', 'bar')

//
// Or call it "async"
//
setTimeout(function () {
  fn.call('foo', 'bar')
}, 10);

License

MIT

Current Tags

  • 1.0.0                                ...           latest (10 years ago)

1 Versions

  • 1.0.0                                ...           10 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (4)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |