# hang

> Force the supplied callback in to async execution

Latest version **1.0.0** (published 2015-04-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install hang
pnpm add hang
yarn add hang
bun add hang
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2015-04-07 |
| First published | 2015-04-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Arnout Kazemier |
| Maintainers | 3rdeden |
| Keywords | dont, keep, me, hanging, bro, hang, suspend, wait, defer, deferred, wating, delay, async, force, sync, execution, callback, pattern |

## Links

- npm: https://www.npmjs.com/package/hang
- Repository: https://github.com/unshiftio/hang
- Issues: https://github.com/unshiftio/hang/issues
- npm.io page: https://npm.io/package/hang

## Alternatives

- [@js-joda/timezone](https://npm.io/package/@js-joda/timezone.md) — 383.4K weekly downloads
- [chartjs-adapter-moment](https://npm.io/package/chartjs-adapter-moment.md) — 210.8K weekly downloads
- [strftime](https://npm.io/package/strftime.md) — 171.2K weekly downloads
- [vue-flatpickr-component](https://npm.io/package/vue-flatpickr-component.md) — 115.8K weekly downloads
- [timepicker](https://npm.io/package/timepicker.md) — 51.0K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2015-04-07

## README

# hang

[![Made by unshift][made-by]](http://unshift.io)[![Version npm][version]](http://browsenpm.org/package/hang)[![Build Status][build]](https://travis-ci.org/unshiftio/hang)[![Dependencies][david]](https://david-dm.org/unshiftio/hang)[![Coverage Status][cover]](https://coveralls.io/r/unshiftio/hang?branch=master)[![IRC channel][irc]](http://webchat.freenode.net/?channels=unshift)

[made-by]: https://img.shields.io/badge/made%20by-unshift-00ffcc.svg?style=flat-square
[version]: https://img.shields.io/npm/v/hang.svg?style=flat-square
[build]: https://img.shields.io/travis/unshiftio/hang/master.svg?style=flat-square
[david]: https://img.shields.io/david/unshiftio/hang.svg?style=flat-square
[cover]: https://img.shields.io/coveralls/unshiftio/hang/master.svg?style=flat-square
[irc]: https://img.shields.io/badge/IRC-irc.freenode.net%23unshift-00a8ff.svg?style=flat-square

`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:

```js
'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

---
_Source: https://npm.io/package/hang · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
