{"name":"async-state","version":"1.1.2","description":"Parse state across async callbacks","main":"index.js","directories":{"example":"example"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git+https://github.com/watson/async-state.git"},"keywords":["async","asynchronous","callback","state","AsyncListener","tracing","async_wrap"],"author":{"name":"Thomas Watson Steen","email":"w@tson.dk","url":"https://twitter.com/wa7son"},"license":"MIT","bugs":{"url":"https://github.com/watson/async-state/issues"},"homepage":"https://github.com/watson/async-state#readme","dependencies":{"async-listener":"^0.5.6","deep-extend":"^0.4.0"},"devDependencies":{"standard":"^5.2.1","tape":"^4.2.0"},"coordinates":[55.6665799,12.5800094],"gitHead":"675bb11dd45b22cc8cdd4d2cdd0f3aaa3dc060c6","_id":"async-state@1.1.2","_shasum":"7053b52762dc90a139a3b79e6b4a942a21861e49","_from":".","_npmVersion":"2.13.4","_nodeVersion":"0.12.7","_npmUser":{"name":"watson","email":"w@tson.dk"},"maintainers":[{"name":"watson","email":"w@tson.dk"}],"dist":{"shasum":"7053b52762dc90a139a3b79e6b4a942a21861e49","tarball":"http://registry-npm.ywwl.com/async-state/download/async-state-1.1.2.tgz","integrity":"sha512-VjJFgWXTIzHVac0b1D4XG3Yumao4olFlH1sIBRreSSkzd/Qyea0b+lVosDrcDy+Sq4eVfcZiB1lpgZMaHQ7/tQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEeusMutpMS4NfOHW1zKXwCMcoTxKj4dDP9kBqu1SVmPAiA87fq4HQgTlYHs44wCwTXc4GKqiB2hVUTBg4hMbf5siQ=="}],"size":2893,"noattachment":false,"key":"/async-state/-/async-state-1.1.2.tgz"},"readme":"# async-state\n\nParse state across async callbacks.\n\n[![Build status](https://travis-ci.org/watson/async-state.svg?branch=master)](https://travis-ci.org/watson/async-state)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard)\n\n## Installation\n\n```\nnpm install async-state\n```\n\n## Usage\n\n```js\nvar asyncState = require('async-state')()\n\nasyncState.foo = 'foo'\n\nsetTimeout(function () {\n  console.log(asyncState.foo) // => foo\n}, 2000)\n\nasyncState.foo = 'bar'\n```\n\nThis also works between files. For a more complex example, see the\n[example\nfolder](https://github.com/watson/async-state/tree/master/example).\n\n## Gotchas\n\nOnly object references are copied across async bounderies. The content\nof the object is shared! I.e. the following will get you into trouble:\n\n```js\nvar asyncState = require('async-state')()\n\nasyncState.obj = { foo: 'foo' }\n\nsetTimeout(function () {\n  console.log(asyncState.obj.foo) // => bar\n}, 2000)\n\n// THIS IS BAD!\nasyncState.obj.foo = 'bar'\n```\n\nTo solve that issue, implement your own cloning logic:\n\n```js\nvar asyncState = require('async-state')()\n\nasyncState.obj = { foo: 'foo' }\n\nsetTimeout(function () {\n  console.log(asyncState.obj.foo) // => foo\n}, 2000)\n\n// THIS IS GOOD :)\nasyncState.obj = { foo: 'bar' }\n```\n\n## Credits\n\nThanks to [Andreas Madsen](https://github.com/AndreasMadsen) for pointing me towards the `async_wrap` API.\n\n## License\n\nMIT\n","publish_time":1442425622033,"_cnpm_publish_time":1442425622033,"dist-tags":{"latest":"2.0.1"}}