{"_id":"@deltasnare/simple-frontend","_rev":"1-7e9ea29ae01cbc2629990ecb21325d35","name":"@deltasnare/simple-frontend","dist-tags":{"latest":"1.1.1"},"versions":{"1.1.1":{"name":"@deltasnare/simple-frontend","version":"1.1.1","description":"State manager frontend for simple (single-chunk) games","main":"lib/index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"author":{"name":"Ben Snow","email":"balintbence97@gmail.com"},"license":"LGPL-3.0","dependencies":{"@deltasnare/core":"^1.0.2"},"directories":{"lib":"lib"},"devDependencies":{},"repository":{"type":"git","url":"git+https://github.com/b3nsn0w/deltasnare-simple-frontend.git"},"bugs":{"url":"https://github.com/b3nsn0w/deltasnare-simple-frontend/issues"},"homepage":"https://github.com/b3nsn0w/deltasnare-simple-frontend#readme","gitHead":"811b1cf0ba592b0f345e4d5c1f5a2ca9e1acebf6","_id":"@deltasnare/simple-frontend@1.1.1","_npmVersion":"6.4.1","_nodeVersion":"10.10.0","_npmUser":{"name":"b3nsn0w","email":"balintbence97@gmail.com"},"dist":{"integrity":"sha512-3ySUgB9XXjdLo8OOWbvlFySAg0Tn6/LLr0IicWMFtu8knV0Hf46jrhTyAdLFW0dynb+Da7DzCUoJs7+JSGkGpg==","shasum":"5d0994b74d42a3b2b57ae0f3e263d69e21eceb4f","tarball":"https://registry.npmjs.org/@deltasnare/simple-frontend/-/simple-frontend-1.1.1.tgz","fileCount":4,"unpackedSize":4768,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcCdwpCRA9TVsSAnZWagAAkHAP/A9C9218K6KzeLoUMM1U\nV0DbsAL7Y9UkUb9k+Ogsx3vvU3/hjMdeCKb1WCLj3DM64cbq0RxNetomWx/n\n1txjwz/JAqH0A9pTxMqVZENry8ngsZmZB/T3UD148Otd+pnJNboG/ozmiQ4J\nTVykoG8LzFO1ojH3ILnG+p1GiyUysuDG1eIH3D1I/q3COiPHB9TK/WbdK3Hi\ntDY01f+dL9u6QR68mfxPMO0B+Ba2bk0dZRGROJQ0dogS3iAk2wtaGGFsVQoO\nHGuZzj5/jwJwhY4RRkZpY6A0HMNCrRSj07caYo84KcvEiq8ZrpMH+Wju0QBK\nE7aotN0nyzWaAfJBe4KP+q0svOZbJaDpQviU10xM1VHH5aVW+ZSdo9wIFWVy\nSaFYlIOYV2q4k9hwb9CeOkEXe5wIvW4xP4+CTlE3oWbFrb4NS/lKikt5jgOo\nAXLnhmRDF7GNY5j40IsEJggo1S8d1/wW+3b0xKGi62RSbasSUka+ysWoxHpm\nJAgowHYtY66BS4fbwq5maQpZCH/Txi0lQjDzL0w9O8R4N7H3dRHup5jd2iMR\nbpfX4fBWKDkfr5GTUlVKjxLsrghtkHzGwubyGNuG6y9MZXTFaNbLkGDp3vuy\nzOsQaik8iyI61w6D2CQlGoy/wuAV13fVAFBku9ocEkUGdm06C40JA8Z4wgRr\ndYEV\r\n=l1xi\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCLT6SdMHdyDifEFaFxw3HWYgSqabV20Q0vR2H7PLbj/wIhAOVFbPyinHVHn2PgHzalfXLCkcyfW4UJNZjXQ+ScpABo"}]},"maintainers":[{"name":"require('rontap')","email":"aron.tatai@gmail.com"},{"name":"b3nsn0w","email":"balintbence97@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/simple-frontend_1.1.1_1544150057357_0.8564778313288615"},"_hasShrinkwrap":false}},"time":{"created":"2018-12-07T02:34:17.187Z","1.1.1":"2018-12-07T02:34:17.448Z","modified":"2022-04-05T03:43:00.775Z"},"maintainers":[{"name":"require('rontap')","email":"aron.tatai@gmail.com"},{"name":"b3nsn0w","email":"balintbence97@gmail.com"}],"description":"State manager frontend for simple (single-chunk) games","homepage":"https://github.com/b3nsn0w/deltasnare-simple-frontend#readme","repository":{"type":"git","url":"git+https://github.com/b3nsn0w/deltasnare-simple-frontend.git"},"author":{"name":"Ben Snow","email":"balintbence97@gmail.com"},"bugs":{"url":"https://github.com/b3nsn0w/deltasnare-simple-frontend/issues"},"license":"LGPL-3.0","readme":"Frontend for single-chunk apps, ready to plug into the public API\n\n# Usage\n\n```javascript\nconst SimpleSnare = require('.')\n\n// const delta = function (state, inputs, options) { ... }\n// const state = { ... }\n\nconst chunk = new SimpleSnare(delta, {\n  state,\n  singleplayer: true\n})\n\nchunk.on('tick', tick => console.log(tick.state))\n\nchunk.advance()\nchunk.setInput('bar')\nchunk.advance()\n```\n\nA class named `SimpleSnare` is exported, with the following methods:\n\n## `SimpleSnare(delta, options)`\n\nThe constructor, where\n\n - `delta`: is the delta function\n - `options`: are the options for the snare. It is forwarded to the core, and the following extra parameters are supported:\n   - `peerId`: ID of the local peer\n   - `singleplayer`: if true, sets up singleplayer mode, which sets `peerId` to `'player'` and automatically joins the peer in the first tick\n\n### `SimpleSnare.setInput(input)`\n\nSets the local peer's input for the current tick. This can only be done once per tick, if it's attempted multiple times, an error is thrown.\n\n### `SimpleSnare.setPeerInput(peerId, tick, input)`\n\nSets a remote peer's input for a given tick.\n\n### `SimpleSnare.setControl(tick, control)`\n\nSets the server's control message for a given tick\n\n### `SimpleSnare.advance()`\n\nAdvances the current tick by 1 and emits a `tick` event\n\n### `SimpleSnare.advanceTo(tick)`\n\nAdvances to the specified tick and emits `tick` events on the way. Does not advance backwards and cannot go further than the double of the core's window size.\n\n### `SimpleSnare.currentTick`\n\nThe current tick ID. Read-only.\n\n### `SimpleSnare.peerId`\n\nThe local peer's ID. Writable, but not recommended to modify. Make sure to remove the old peer and add the new one.\n\n# Events\n\n`SimpleSnare` is an event emitter. It emits two kind of events:\n\n## `tick`\n\nThe tick event is emitted every time there is a new tick. It has two parameters, the current and the previous tick.\n\n## `input`\n\nWhen the local peer's input is set, an input event is emitted. This allows the network layer to listen directly to the snare frontend.","readmeFilename":"README.md"}