{"_id":"@callmehiphop/ticker","_rev":"8-57a990a9a2b962d29cc1c6a68fb6da1b","name":"@callmehiphop/ticker","time":{"modified":"2022-06-12T15:37:43.436Z","created":"2016-10-05T05:09:45.719Z","0.1.0":"2016-10-05T05:09:45.719Z","0.1.1":"2016-10-05T05:15:36.746Z","0.2.0":"2016-10-05T05:48:24.962Z","0.2.1":"2016-10-06T05:50:39.481Z"},"maintainers":[{"name":"callmehiphop","email":"callmehiphop@gmail.com"}],"dist-tags":{"latest":"0.2.1"},"description":"Simple event-based fixed-rate game loop.","readme":"# ticker\n\n> Simple event based game loop based on the Game Programming Patterns [Game Loop](http://gameprogrammingpatterns.com/game-loop.html) chapter.\n\n## Install\n\n```sh\n$ npm install --save @callmehiphop/ticker\n```\n\n## Usage\n\n```js\nconst Ticker = require('@callmehiphop/ticker');\nconst ticker = new Ticker();\n\nticker.on('update', (dt) => {\n  // update all the things!\n});\n\nticker.on('render', () => {\n  // render all the things!\n});\n\n// stop the ticker\nticker.stop();\n\n// resume the ticker\nticker.resume();\n```\n\n## API\n\n### new Ticker(el, [fps])\n\n#### el\n\nType: `canvas`\n\nHTML element to be passed into `requestAnimationFrame` - presumably canvas.\n\n#### fps\n\nType: `number`<br>\nDefault: `60`\n\nDesired frames per second, this will alter how often the `update` event is fired.\n\n```js\nconst canvas = document.getElementById('my-canvas');\nconst ticker = new Ticker(canvas, 30);\n```\n\n### ticker.on('update', handler)\n\nIndicates models should be updated with provided delta time.\n\n#### handler(dt)\n\nType: `function`\n\n```js\nticker.on('update', (dt) => {\n  // Update all your models.\n});\n```\n\n### ticker.on('render', handler)\n\nIndicates that you should draw the current state of your models.\n\n#### handler(frameStep)\n\n`frameStep` is how far into the current frame we are.\n\nType: `function`\n\n```js\nticker.on('render', (frameStep) => {\n  // Render all your models.\n});\n```\n\n### ticker.stop()\n\nStops the ticker.\n\n```js\nticker.stop();\n```\n\n### ticker.resume()\n\nResumes the ticker.\n\n```js\nticker.resume();\n```\n\n## License\n\nMIT\n","versions":{"0.2.0":{"name":"@callmehiphop/ticker","version":"0.2.0","description":"Simple event-based fixed-rate game loop.","main":"index.js","scripts":{"test":"eslint ./*.js && mocha ./test.js"},"repository":{"type":"git","url":"git://github.com/callmehiphop/ticker.git"},"keywords":["game","loop","timestep","ticker","tick","fixed"],"author":{"name":"Dave Gramlich","email":"callmehiphop@gmail.com"},"license":"MIT","dependencies":{"performance-now":"^0.2.0","raf":"^3.3.0"},"devDependencies":{"eslint":"^3.7.1","mocha":"^3.1.0"},"gitHead":"8074c0e063218b4ac1abfe36d118827154dc9d56","bugs":{"url":"https://github.com/callmehiphop/ticker/issues"},"homepage":"https://github.com/callmehiphop/ticker#readme","_id":"@callmehiphop/ticker@0.2.0","_shasum":"b686a85c8884f3f5a4bae23ab82c8e7b2a810bea","_from":".","_npmVersion":"3.9.3","_nodeVersion":"6.2.1","_npmUser":{"name":"callmehiphop","email":"callmehiphop@gmail.com"},"dist":{"shasum":"b686a85c8884f3f5a4bae23ab82c8e7b2a810bea","tarball":"https://registry.npmjs.org/@callmehiphop/ticker/-/ticker-0.2.0.tgz","integrity":"sha512-VX9dN1N2iK0doy8FXWKAAysYRNn6MpSAhlwh395VVL7EwyBmDU9fnt2Q+cBJizRrWYRXCyRGmUbV+e3hNm+WAg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCuWoYwIXH7C9WVLKiQNMl4AFURSDplFvR7iMaQV1IbHgIhAJTcsJb1naDqOxY6CXGbHJoJJWAVLiMteet2w2wXWFQa"}]},"maintainers":[{"name":"callmehiphop","email":"callmehiphop@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/ticker-0.2.0.tgz_1475646503480_0.5194658804684877"}},"0.2.1":{"name":"@callmehiphop/ticker","version":"0.2.1","description":"Simple event-based fixed-rate game loop.","main":"index.js","scripts":{"test":"eslint ./*.js && mocha ./test.js"},"repository":{"type":"git","url":"git://github.com/callmehiphop/ticker.git"},"keywords":["game","loop","timestep","ticker","tick","fixed"],"author":{"name":"Dave Gramlich","email":"callmehiphop@gmail.com"},"license":"MIT","dependencies":{"performance-now":"^0.2.0","raf":"^3.3.0"},"devDependencies":{"eslint":"^3.7.1","mocha":"^3.1.0"},"gitHead":"cd5572485e903c8b21f415245602cbe10fb3d73c","bugs":{"url":"https://github.com/callmehiphop/ticker/issues"},"homepage":"https://github.com/callmehiphop/ticker#readme","_id":"@callmehiphop/ticker@0.2.1","_shasum":"f647af480c91971f0f4f3998c590a448106ec11c","_from":".","_npmVersion":"3.9.3","_nodeVersion":"6.2.1","_npmUser":{"name":"callmehiphop","email":"callmehiphop@gmail.com"},"dist":{"shasum":"f647af480c91971f0f4f3998c590a448106ec11c","tarball":"https://registry.npmjs.org/@callmehiphop/ticker/-/ticker-0.2.1.tgz","integrity":"sha512-pndOMVpXYKNXbDhYKHTIDCT5oXqUCliPYvOSgj+O03qMFVQ7eemGND08TPJCK3hpzFOnvm5LZgQQHqxmf8TAkA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDI5lhJCP4138w7jaFZyJ4Y4Lna/DmJku+qCrdN9G99PwIhALSc3vc+OlEGPbxbhVhwfu1y2bFK4YW2AIhgwMnunGxL"}]},"maintainers":[{"name":"callmehiphop","email":"callmehiphop@gmail.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/ticker-0.2.1.tgz_1475733037176_0.012900165747851133"}}},"homepage":"https://github.com/callmehiphop/ticker#readme","keywords":["game","loop","timestep","ticker","tick","fixed"],"repository":{"type":"git","url":"git://github.com/callmehiphop/ticker.git"},"author":{"name":"Dave Gramlich","email":"callmehiphop@gmail.com"},"bugs":{"url":"https://github.com/callmehiphop/ticker/issues"},"license":"MIT","readmeFilename":"README.md"}