{"_id":"flow-stoplight","_rev":"4641974","name":"flow-stoplight","description":"A simple flow control mechanism.","dist-tags":{"latest":"1.0.0"},"maintainers":[{"name":"kumavis","email":"aaron@kumavis.me"}],"time":{"modified":"2026-04-10T19:59:33.000Z","created":"2016-02-08T22:06:42.561Z","1.0.0":"2016-02-08T22:06:42.561Z"},"users":{},"author":"","versions":{"1.0.0":{"name":"flow-stoplight","version":"1.0.0","description":"A simple flow control mechanism.","main":"index.js","scripts":{"test":"node test.js"},"author":"","license":"ISC","devDependencies":{"tape":"^4.4.0"},"gitHead":"b985792e505c0a9d4e7918be4cdb538450b9853f","_id":"flow-stoplight@1.0.0","_shasum":"4a292c5bcff8b39fa6cc0cb1a853d86f27eeff7b","_from":".","_npmVersion":"3.5.2","_nodeVersion":"4.2.3","_npmUser":{"name":"kumavis","email":"aaron@kumavis.me"},"dist":{"shasum":"4a292c5bcff8b39fa6cc0cb1a853d86f27eeff7b","size":1668,"noattachment":false,"key":"/flow-stoplight/-/flow-stoplight-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/flow-stoplight/download/flow-stoplight-1.0.0.tgz"},"maintainers":[{"name":"kumavis","email":"aaron@kumavis.me"}],"_npmOperationalInternal":{"host":"packages-6-west.internal.npmjs.com","tmp":"tmp/flow-stoplight-1.0.0.tgz_1454969201565_0.9441104403231293"},"directories":{},"publish_time":1454969202561,"_hasShrinkwrap":false,"_cnpm_publish_time":1454969202561,"_cnpmcore_publish_time":"2021-12-16T19:19:38.081Z"}},"readme":"### Stoplight\n\nA simple flow control mechanism.\n\nHas two modes: \"go\" and \"stop\".\n\nStarts stopped.\n\n```js\nvar stoplight = new Stoplight()\n\nstoplight.await(function(){\n  // this will called when the stoplight is set to \"go\"\n  // if its already \"go\", it will be called on the next frame\n})\n\n// starts stopped\nstoplight.go()\n```\n\n\n### Example\n\nHere is a class that has some async intialization process,\nbut can have its asynchronous method called immediately w/o breaking.\n\n```js\n\nfunction MyClass() {\n  var self = this\n  self._stoplight = new Stoplight()\n  asyncInitialization(function(){\n    self._stoplight.go()\n  })\n}\n\nMyClass.prototype.asyncMethod = function(cb){\n  var self = this\n  self._stoplight.await(function(){\n    // handle the method here and you can be sure that\n    // the async initialization has finished\n  })\n}\n```","_attachments":{},"license":"ISC"}