{"_id":"@amate/on-frame","_rev":"2-f0e26c0522b70c8bd34f8f85bcba3ed1","name":"@amate/on-frame","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@amate/on-frame","version":"1.0.0","repository":{"type":"git","url":"git+https://github.com/christiandewit/on-frame.git"},"description":"Batches calls to requestAnimationFrame","main":"./dist/on-frame.umd.cjs","module":"./dist/on-frame.mjs","types":"./dist/index.d.ts","exports":{".":{"import":"./dist/on-frame.mjs","require":"./dist/on-frame.umd.cjs"}},"scripts":{"prepare":"npm run build","prepublishOnly":"npm run format && npm run lint","preversion":"npm run format && npm run lint","build":"vite build","lint":"eslint .","format":"prettier --write .","test":"vitest run --reporter verbose","coverage":"vitest run --coverage"},"keywords":["raf","requestAnimationFrame","onFrame"],"author":{"name":"Christian de Wit","email":"mail@christiandewit.com"},"license":"MIT","devDependencies":{"@typescript-eslint/eslint-plugin":"^5.58.0","@typescript-eslint/parser":"^5.58.0","@vitest/coverage-c8":"^0.30.1","eslint":"^8.38.0","eslint-config-prettier":"^8.8.0","jsdom":"^21.1.1","prettier":"^2.8.7","typescript":"^5.0.4","vite":"^4.2.2","vite-plugin-dts":"^2.3.0","vitest":"^0.30.1"},"gitHead":"bf133ba33d03f373afab5483b362d62e80d37a15","bugs":{"url":"https://github.com/christiandewit/on-frame/issues"},"homepage":"https://github.com/christiandewit/on-frame#readme","_id":"@amate/on-frame@1.0.0","_nodeVersion":"18.16.0","_npmVersion":"9.5.1","dist":{"integrity":"sha512-iqCqQCQw5lAVXDwG0HinGMFl/Jfk0fHPpeE4D+Ez5FTeMDAJ32CIO3gBvNqa5NvfE0aZhngiN/8GLCnjhKnM/g==","shasum":"44232b967644239a5cdef04456dff1b01d83264f","tarball":"https://registry.npmjs.org/@amate/on-frame/-/on-frame-1.0.0.tgz","fileCount":6,"unpackedSize":3953,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIA/gK9UtB6xPR+RPYR1srJvNfO81Q5OoEOBpOqc68eWiAiAK1q1Ap4dP+ifEaQh+zqIadMZM2ukq67esFngDFwJ06Q=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkPqpLACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpNHhAAiW2pbHLB4zUWMb2ku4w2t9ne+zP1h4wAZEjhuRXXHs3cevSW\r\nmRi3RX/qlypn3GBn2ODjmevhhyecDhtfiE2v8y7VRY/FKYOxtk3fkJ/v26+x\r\niygOJwvdfFeNJF+pEKbU+ofxev9zzl9nqJP18BvGAfX4cnfOro05uVa60aSR\r\n0MyRvwvYnZf+5MP+TL22Ql147/XOQm1I3SBUMSgyi3oRvGW8z0DXBU5V+tYP\r\ne3cA6fmAKqNJWpu6Cf3AXklcahAIIvHq+g9OybMFWoPkEjOule7PDnS1/Gyt\r\n42xzUGqjSdWE7Tw1h2ODVNc/DjdDty/vG6rmB8lfTq/1Y3BIQymhl8BAf2ct\r\n1jmrniZPt0yCEUMka+6i6MCZa4Kp5fED9ayoe/yoHbv5DxaIRsPS1dgD3b8m\r\nKWVwh+ijVtOWBSkKPLZbHe9Q70HYveBt92i+3RbN8CIQW0aZWsxUCZ0i8Awm\r\nE3v/BxNz4ifGYy/OGLkwm64ls6JkyfvVVMMTKqQc48A8IGhi2ZULaB4X1+uW\r\nqbHZmYhD/pOY1NY6gdqmsqzq5RHyL3KhhCBwO3MZmHQEX3lRcW8eCPuhpJAM\r\n6R1hUHvK/UUUq3BdS6KzS27+c0NJEJAOUZGzlrN7RQWq2S92lY/cmLtY1I46\r\n6I3X3SpTL/vJg7TEKER/h4O+Nv7pEhYG9us=\r\n=AqcL\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"christiandewit","email":"mail@christiandewit.com"},"directories":{},"maintainers":[{"name":"christiandewit","email":"mail@christiandewit.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/on-frame_1.0.0_1681828427388_0.35356046391504625"},"_hasShrinkwrap":false},"1.0.1":{"name":"@amate/on-frame","version":"1.0.1","repository":{"type":"git","url":"git+https://github.com/christiandewit/on-frame.git"},"description":"Batches calls to requestAnimationFrame","main":"./dist/on-frame.umd.cjs","module":"./dist/on-frame.mjs","types":"./dist/index.d.ts","exports":{".":{"import":"./dist/on-frame.mjs","require":"./dist/on-frame.umd.cjs"}},"scripts":{"prepare":"npm run build","prepublishOnly":"npm run format && npm run lint","preversion":"npm run format && npm run lint","build":"vite build","lint":"eslint .","format":"prettier --write .","test":"vitest run --reporter verbose","coverage":"vitest run --coverage","bench":"vitest bench --run"},"keywords":["raf","requestAnimationFrame","onFrame","animation"],"author":{"name":"Christian de Wit","email":"mail@christiandewit.com"},"license":"MIT","devDependencies":{"@typescript-eslint/eslint-plugin":"^5.58.0","@typescript-eslint/parser":"^5.58.0","@vitest/coverage-c8":"^0.30.1","eslint":"^8.38.0","eslint-config-prettier":"^8.8.0","jsdom":"^21.1.1","prettier":"^2.8.7","typescript":"^5.0.4","vite":"^4.2.2","vite-plugin-dts":"^2.3.0","vitest":"^0.30.1"},"gitHead":"62d223118550f7edefacfd7494b54bf8b37966df","bugs":{"url":"https://github.com/christiandewit/on-frame/issues"},"homepage":"https://github.com/christiandewit/on-frame#readme","_id":"@amate/on-frame@1.0.1","_nodeVersion":"18.16.0","_npmVersion":"9.5.1","dist":{"integrity":"sha512-siai8VQGcalacweM+kFyJ6LpSTH2DoSFZf49MHABy4CTbwZ0Y6VdAO6X0mxG7X7xmryZg5HnTriK5CC/OOYbRg==","shasum":"c1b4a47a0c39f02caa2fc7edf45cb08ab9f058f2","tarball":"https://registry.npmjs.org/@amate/on-frame/-/on-frame-1.0.1.tgz","fileCount":6,"unpackedSize":4903,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEjgZjpXny6sVKMw/RJO7olw5V2wUH0FDwvPfxMnfXNxAiACAl9F9vVc6JANi1N3+R3ny3aEjC9IHauKkGvgBsQbqg=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkQAJaACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr45hAAjF+mRwCNKoyQXdu4FNlnOymR52uDeIJunqQjJKT2m4iLvjEg\r\ntJYOqoy4wylAS2SKWnA7sGvPL1+TPpTYZIfsRrZ0NMf1OH2G7wIkMcq7YZI5\r\nsl4R9Odr8ztIiEgY/Sn4CEl0bHkstAiPoGezICYc4xB1hnX0uqciPQclFwF/\r\nnJqWXRmrT3ALwiogno2blhkxoEsBX9nl4pzP1vHfKGYKDz0j2HpyOG0uB/0m\r\nTmjD+MYyhNstAc/9L8xoXlZeGUPoPBlUXkg4X5WS77iXBCYFPWyhq5NfNLiA\r\nQC4Vl7r39Q0ag+uQgXlIKHhC0/tjxKhZsEYJ5+J1MjeSEZEeaiGyfsAXMP/e\r\ntGpCWKlnGNhk82rE5BMJYxjzazwZWgEEujMnFsiThaW39tpsx7SOjlw+mwX6\r\nNTZX/egohWQ4VSPBDFzPFD8mNh4DyuWbonxyyFEqoGS2Vbqz87pdAgnYfam/\r\n6VMY3YMqAUn03DuWFwvKRoZHnHnzxubzcMssTw9zhElCQCdEBJA8ElwbMVQg\r\niGrt6vk5G8ez06Z36DTzqmWJKySju+D1NTdEIv8oNpjnROCSXR6ZHXk/sbUo\r\nvC58xSueOa6ZQ2VtGWjZpkP9XS2TChLDvzKXfk8i+YekTGLsPSsaiU4DdQxd\r\nTK0A3DtPQtkv50mmOuQoxipAPpRrEU3O4cM=\r\n=khw/\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"christiandewit","email":"mail@christiandewit.com"},"directories":{},"maintainers":[{"name":"christiandewit","email":"mail@christiandewit.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/on-frame_1.0.1_1681916505970_0.9558621386878068"},"_hasShrinkwrap":false},"1.0.2":{"name":"@amate/on-frame","version":"1.0.2","repository":{"type":"git","url":"git+https://github.com/christiandewit/on-frame.git"},"description":"Batches calls to requestAnimationFrame","main":"./dist/on-frame.umd.cjs","module":"./dist/on-frame.mjs","types":"./dist/index.d.ts","exports":{".":{"import":"./dist/on-frame.mjs","require":"./dist/on-frame.umd.cjs"}},"scripts":{"prepare":"npm run build","prepublishOnly":"npm run format && npm run lint","preversion":"npm run format && npm run lint","build":"vite build","lint":"eslint .","format":"prettier --write .","test":"vitest run --reporter verbose","coverage":"vitest run --coverage","bench":"vitest bench --run"},"keywords":["raf","requestAnimationFrame","onFrame","animation"],"author":{"name":"Christian de Wit","email":"mail@christiandewit.com"},"license":"MIT","devDependencies":{"@typescript-eslint/eslint-plugin":"^5.58.0","@typescript-eslint/parser":"^5.58.0","@vitest/coverage-c8":"^0.30.1","eslint":"^8.38.0","eslint-config-prettier":"^8.8.0","jsdom":"^21.1.1","prettier":"^2.8.7","typescript":"^5.0.4","vite":"^4.2.2","vite-plugin-dts":"^2.3.0","vitest":"^0.30.1"},"gitHead":"ea6a5c9e8ee8c1fb61f3a01c82af37aaaaa01e65","bugs":{"url":"https://github.com/christiandewit/on-frame/issues"},"homepage":"https://github.com/christiandewit/on-frame#readme","_id":"@amate/on-frame@1.0.2","_nodeVersion":"18.16.0","_npmVersion":"9.5.1","dist":{"integrity":"sha512-ZSUgA/iSUozfofwhS85BqL6fl3+p2qW4QRZAn8IXsrZ/ZqpXm0o9dfKCpC36ogoykstHSSiouYB4fJCzv3ZrDA==","shasum":"2762f807f7ef43126dd9524a18ad160e92c0110d","tarball":"https://registry.npmjs.org/@amate/on-frame/-/on-frame-1.0.2.tgz","fileCount":6,"unpackedSize":4903,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD2ButZarpFn/yQzDr1cnL/O3bfhFnot60vi+4EVoFEUwIgKZp6NgtC9qA42dkbG1HCbtaIpfudogS1+d5ILxIYJHk="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkQPwHACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo+qQ//RD2qsoCbDs463r5HKK765C4FqwLMPzoeMqVQ0FpF58WtkwIq\r\nqTifUop8npSF4FmmcSvXv8Xunifq0erLOCZTrFRN1YRl8O6HeNMlJZvzp5TS\r\nXfvVQjmsw+jvw7q3SlkO1R/2thhQFzfUVYkkNbrOVDrPSP+H237RQz+em54A\r\njtoCoURPxwpOUZGoI59WhwY/RJDx74BLmaThwWEsr+r2yu2z4IQMhUYcC6yM\r\nSP+FF/X1prrrQfEG8e1UwqytYCPffCBWySfaJb0IcQT/PYSE6/yI6r7qEGTn\r\ngJ8M5RmxekoBRt2jLMKrhRBFjQ2h5KzZaeizI7/nU6RG6Q+tv8w6EnMDO79+\r\n2++Y7dbtv8TV4I+E9eniY6PorYx+A2RWXt4ISANDTd1bNX4MXiMUltNjaCy5\r\nzn7khE5yeRw3lk5L0TN3o8HjqBjgffrUbhu9jUiVFFQWHICtYisQHj+wfFOI\r\nsW+InxRXv84VWWDTplYAg9/0VcJWCYRTQ1FANEZcXsZzeY85nLnWEvEDQWkE\r\nqkC89+FooVMnJozxP8HVSgpfGPIZaN5cgKaeA0JY7a6mSxk3939sAqGP1dza\r\nZ7R1doZ3oES1fwEPMy4xRdxrTS8LFKpwrHnWeTw/oXFjub2mqaXmSBnRNIio\r\nnyqrYwQyHB5qI7Ey8ErR80hB3ZvhQjzapM4=\r\n=uPkE\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"christiandewit","email":"mail@christiandewit.com"},"directories":{},"maintainers":[{"name":"christiandewit","email":"mail@christiandewit.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/on-frame_1.0.2_1681980423446_0.7925067333674649"},"_hasShrinkwrap":false}},"time":{"created":"2023-04-18T14:33:47.317Z","1.0.0":"2023-04-18T14:33:47.567Z","modified":"2023-04-20T08:47:03.757Z","1.0.1":"2023-04-19T15:01:46.143Z","1.0.2":"2023-04-20T08:47:03.604Z"},"maintainers":[{"name":"christiandewit","email":"mail@christiandewit.com"}],"description":"Batches calls to requestAnimationFrame","homepage":"https://github.com/christiandewit/on-frame#readme","keywords":["raf","requestAnimationFrame","onFrame","animation"],"repository":{"type":"git","url":"git+https://github.com/christiandewit/on-frame.git"},"author":{"name":"Christian de Wit","email":"mail@christiandewit.com"},"bugs":{"url":"https://github.com/christiandewit/on-frame/issues"},"license":"MIT","readme":"# on-frame\n\n[![npm (scoped)](https://img.shields.io/npm/v/@amate/on-frame)](https://www.npmjs.com/package/@amate/on-frame)\n[![npm bundle size (scoped)](https://img.shields.io/bundlephobia/minzip/@amate/on-frame)](https://bundlephobia.com/package/@amate/on-frame)\n[![NPM](https://img.shields.io/npm/l/@amate/on-frame)](https://github.com/christiandewit/on-frame/blob/main/LICENSE.md)\n\nBatches calls to requestAnimationFrame.\n\n## API\n\n- `onFrame(subscriber: Subscriber): () => boolean`\n- `type Subscriber = (time: DOMHighResTimeStamp) => void;`\n\n## How it works\n\nThe return value of `onFrame` is an unsubscribe function, it returns a `boolean`that indicates if unsubscribing was successful.\n\nThe timestamp passed to the subscriber is the original timestamp as provided by the `requestAnimationFrame` callback.\n\nFunctions can only be subscribed once, but invoking it multiple times is fine as it will also return an `unsubscribe` function.\n\n## Example\n\n```\nimport { onFrame } from 'on-frame';\n\nlet i = 0;\n\nconst unsubscribe = onFrame((time) => {\n  console.log(`frame called at ${time}`);\n\n  i += 1;\n\n  // stop after 5 ticks\n  if (i === 5) {\n    unsubscribe();\n  }\n});\n```\n","readmeFilename":"README.md"}