Socket
Socket
Sign inDemoInstall

hang

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    hang

Force the supplied callback in to async execution


Version published
Weekly downloads
7.9K
increased by0.2%
Maintainers
1
Install size
7.03 kB
Created
Weekly downloads
 

Readme

Source

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

Keywords

FAQs

Last updated on 07 Apr 2015

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