Comparing version 5.2.3 to 5.3.0
@@ -5,2 +5,8 @@ # Changelog | ||
## [5.3.0] 2021-03-30 | ||
### Added | ||
- Adding `flushSync` API for manual flushing of job queues. | ||
## [5.2.3] 2021-03-19 | ||
@@ -10,3 +16,3 @@ | ||
- Fixing `main` entry point. | ||
- Fixing `main` entry point. | ||
@@ -17,3 +23,3 @@ ## [5.2.2] 2021-03-19 | ||
- Fixing `main` entry point. | ||
- Fixing `main` entry point. | ||
@@ -24,7 +30,7 @@ ## [5.2.1] 2021-03-19 | ||
- Adding `exports` to `package.json`. | ||
- Adding `exports` to `package.json`. | ||
### Updated | ||
- `tslib` to latest. | ||
- `tslib` to latest. | ||
@@ -35,3 +41,3 @@ ## [5.2.0] 2021-03-01 | ||
- Unbundling ES code to facilitate code-splitting in Webpack. | ||
- Unbundling ES code to facilitate code-splitting in Webpack. | ||
@@ -42,3 +48,3 @@ ## [5.1.0] 2021-02-22 | ||
- Adding polyfill for `performance.now` for better compatibility with Node environments. | ||
- Adding polyfill for `performance.now` for better compatibility with Node environments. | ||
@@ -49,3 +55,3 @@ ## [5.0.0] 2021-01-01 | ||
- Using `performance.now` to measure polyfilled elapsed time. | ||
- Using `performance.now` to measure polyfilled elapsed time. | ||
@@ -56,3 +62,3 @@ ## [4.1.0] 2020-8-24 | ||
- `preRender` step. | ||
- `preRender` step. | ||
@@ -63,3 +69,3 @@ ## [4.0.2] 2019-02-05 | ||
- Fixing rescheduling keepAlive method. | ||
- Fixing rescheduling keepAlive method. | ||
@@ -70,3 +76,3 @@ ## [4.0.1] 2018-09-24 | ||
- Updated README. | ||
- Updated README. | ||
@@ -77,9 +83,9 @@ ## [4.0.0] 2018-09-24 | ||
- New API. | ||
- `onFrameUpdate(callback, immediate)` -> `sync.update(callback, keepAlive, immediate)` | ||
- `cancelOnFrameUpdate(callback)` -> `cancelSync.update(callback)` | ||
- New API. | ||
- `onFrameUpdate(callback, immediate)` -> `sync.update(callback, keepAlive, immediate)` | ||
- `cancelOnFrameUpdate(callback)` -> `cancelSync.update(callback)` | ||
### Added | ||
- `keepAlive` parameter. | ||
- `keepAlive` parameter. | ||
@@ -90,3 +96,3 @@ ## [3.1.9] 2018-05-16 | ||
- Fixing Rollup config. | ||
- Fixing Rollup config. | ||
@@ -97,3 +103,3 @@ ## [3.1.8] 2018-05-13 | ||
- Rollup support for outputting ES modules and UMD bundles. | ||
- Rollup support for outputting ES modules and UMD bundles. | ||
@@ -104,3 +110,3 @@ ## [3.1.7] 2018-01-04 | ||
- Fixing illegal invocation errors. | ||
- Fixing illegal invocation errors. | ||
@@ -111,3 +117,3 @@ ## [3.1.6] 2018-01-04 | ||
- Using previous frame duration as default duration (for instance between active cycles). | ||
- Using previous frame duration as default duration (for instance between active cycles). | ||
@@ -118,3 +124,3 @@ ## [3.1.5] 2018-01-04 | ||
- Cleaning polyfill. | ||
- Cleaning polyfill. | ||
@@ -125,4 +131,4 @@ ## [3.1.4] 2018-01-04 | ||
- Max permitted time elapsed is now 40ms to permit 30fps max. | ||
- When `startRenderLoop` is fired, and the loop is not active, we set a new `currentTime`. | ||
- Max permitted time elapsed is now 40ms to permit 30fps max. | ||
- When `startRenderLoop` is fired, and the loop is not active, we set a new `currentTime`. | ||
@@ -133,3 +139,3 @@ ## [3.1.3] 2017-11-08 | ||
- Actually pointing to new declaration file. | ||
- Actually pointing to new declaration file. | ||
@@ -140,3 +146,3 @@ ## [3.1.2] 2017-11-08 | ||
- Pointing to new declaration file. | ||
- Pointing to new declaration file. | ||
@@ -147,3 +153,3 @@ ## [3.1.1] 2017-11-08 | ||
- Automatically exporting declaration file. | ||
- Automatically exporting declaration file. | ||
@@ -154,7 +160,7 @@ ## [3.1.0] 2017-11-08 | ||
- Added optional `true` flag to `schedule`. This will schedule a job to run at the end of the current frame step. | ||
- Added optional `true` flag to `schedule`. This will schedule a job to run at the end of the current frame step. | ||
## [3.0.0] 2017-08-28 | ||
- `currentFrameTimestamp` becomes `currentFrameTime` for symmetry with `currentTime`. | ||
- `currentFrameTimestamp` becomes `currentFrameTime` for symmetry with `currentTime`. | ||
@@ -164,7 +170,9 @@ ## [2.0.1] 2017-08-26 | ||
### Added | ||
- Changelog and Readme. | ||
- Changelog and Readme. | ||
## [2.0.0] 2017-08-26 | ||
### Added | ||
- First publish. | ||
- First publish. |
@@ -37,2 +37,8 @@ import { onNextFrame, defaultTimestep } from './on-next-frame.js'; | ||
}, {}); | ||
var flushSync = /*#__PURE__*/stepsOrder.reduce(function (acc, key) { | ||
acc[key] = function () { | ||
return steps[key].process(frame); | ||
}; | ||
return acc; | ||
}, {}); | ||
var processStep = function (stepId) { | ||
@@ -63,2 +69,2 @@ return steps[stepId].process(frame); | ||
export default sync; | ||
export { cancelSync, getFrameData }; | ||
export { cancelSync, flushSync, getFrameData }; |
@@ -100,2 +100,6 @@ 'use strict'; | ||
}, {}); | ||
var flushSync = stepsOrder.reduce(function (acc, key) { | ||
acc[key] = function () { return steps[key].process(frame); }; | ||
return acc; | ||
}, {}); | ||
var processStep = function (stepId) { return steps[stepId].process(frame); }; | ||
@@ -126,2 +130,3 @@ var processFrame = function (timestamp) { | ||
exports.default = sync; | ||
exports.flushSync = flushSync; | ||
exports.getFrameData = getFrameData; |
@@ -102,2 +102,6 @@ (function (global, factory) { | ||
}, {}); | ||
var flushSync = stepsOrder.reduce(function (acc, key) { | ||
acc[key] = function () { return steps[key].process(frame); }; | ||
return acc; | ||
}, {}); | ||
var processStep = function (stepId) { return steps[stepId].process(frame); }; | ||
@@ -128,2 +132,3 @@ var processFrame = function (timestamp) { | ||
exports.default = sync; | ||
exports.flushSync = flushSync; | ||
exports.getFrameData = getFrameData; | ||
@@ -130,0 +135,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).framesync={})}(this,(function(e){"use strict";var n=1/60*1e3,t="undefined"!=typeof performance?function(){return performance.now()}:function(){return Date.now()},r="undefined"!=typeof window?function(e){return window.requestAnimationFrame(e)}:function(e){return setTimeout((function(){return e(t())}),n)};var u=!0,o=!1,i=!1,f={delta:0,timestamp:0},c=["read","update","preRender","render","postRender"],a=c.reduce((function(e,n){return e[n]=function(e){var n=[],t=[],r=0,u=!1,o=new WeakSet,i={schedule:function(e,i,f){void 0===i&&(i=!1),void 0===f&&(f=!1);var c=f&&u,a=c?n:t;return i&&o.add(e),-1===a.indexOf(e)&&(a.push(e),c&&u&&(r=n.length)),e},cancel:function(e){var n=t.indexOf(e);-1!==n&&t.splice(n,1),o.delete(e)},process:function(f){var c;if(u=!0,n=(c=[t,n])[0],(t=c[1]).length=0,r=n.length)for(var a=0;a<r;a++){var d=n[a];d(f),o.has(d)&&(i.schedule(d),e())}u=!1}};return i}((function(){return o=!0})),e}),{}),d=c.reduce((function(e,n){var t=a[n];return e[n]=function(e,n,r){return void 0===n&&(n=!1),void 0===r&&(r=!1),o||m(),t.schedule(e,n,r)},e}),{}),s=c.reduce((function(e,n){return e[n]=a[n].cancel,e}),{}),l=function(e){return a[e].process(f)},p=function(e){o=!1,f.delta=u?n:Math.max(Math.min(e-f.timestamp,40),1),f.timestamp=e,i=!0,c.forEach(l),i=!1,o&&(u=!1,r(p))},m=function(){o=!0,u=!0,i||r(p)};e.cancelSync=s,e.default=d,e.getFrameData=function(){return f},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).framesync={})}(this,(function(e){"use strict";var n=1/60*1e3,t="undefined"!=typeof performance?function(){return performance.now()}:function(){return Date.now()},r="undefined"!=typeof window?function(e){return window.requestAnimationFrame(e)}:function(e){return setTimeout((function(){return e(t())}),n)};var u=!0,o=!1,i=!1,c={delta:0,timestamp:0},f=["read","update","preRender","render","postRender"],d=f.reduce((function(e,n){return e[n]=function(e){var n=[],t=[],r=0,u=!1,o=new WeakSet,i={schedule:function(e,i,c){void 0===i&&(i=!1),void 0===c&&(c=!1);var f=c&&u,d=f?n:t;return i&&o.add(e),-1===d.indexOf(e)&&(d.push(e),f&&u&&(r=n.length)),e},cancel:function(e){var n=t.indexOf(e);-1!==n&&t.splice(n,1),o.delete(e)},process:function(c){var f;if(u=!0,n=(f=[t,n])[0],(t=f[1]).length=0,r=n.length)for(var d=0;d<r;d++){var a=n[d];a(c),o.has(a)&&(i.schedule(a),e())}u=!1}};return i}((function(){return o=!0})),e}),{}),a=f.reduce((function(e,n){var t=d[n];return e[n]=function(e,n,r){return void 0===n&&(n=!1),void 0===r&&(r=!1),o||h(),t.schedule(e,n,r)},e}),{}),s=f.reduce((function(e,n){return e[n]=d[n].cancel,e}),{}),l=f.reduce((function(e,n){return e[n]=function(){return d[n].process(c)},e}),{}),p=function(e){return d[e].process(c)},m=function(e){o=!1,c.delta=u?n:Math.max(Math.min(e-c.timestamp,40),1),c.timestamp=e,i=!0,f.forEach(p),i=!1,o&&(u=!1,r(m))},h=function(){o=!0,u=!0,i||r(m)};e.cancelSync=s,e.default=a,e.flushSync=l,e.getFrameData=function(){return c},Object.defineProperty(e,"__esModule",{value:!0})})); |
@@ -1,4 +0,5 @@ | ||
import { Process, FrameData, CancelSync, Sync } from "./types"; | ||
import { Process, FrameData, CancelSync, FlushSync, Sync } from "./types"; | ||
declare const sync: Sync; | ||
declare const cancelSync: CancelSync; | ||
declare const flushSync: FlushSync; | ||
declare const getFrameData: () => { | ||
@@ -9,2 +10,2 @@ delta: number; | ||
export default sync; | ||
export { cancelSync, getFrameData, FrameData, Process }; | ||
export { cancelSync, flushSync, getFrameData, FrameData, Process }; |
@@ -37,2 +37,6 @@ import { onNextFrame, defaultTimestep } from "./on-next-frame"; | ||
}, {}); | ||
var flushSync = stepsOrder.reduce(function (acc, key) { | ||
acc[key] = function () { return steps[key].process(frame); }; | ||
return acc; | ||
}, {}); | ||
var processStep = function (stepId) { return steps[stepId].process(frame); }; | ||
@@ -61,3 +65,3 @@ var processFrame = function (timestamp) { | ||
export default sync; | ||
export { cancelSync, getFrameData }; | ||
export { cancelSync, flushSync, getFrameData }; | ||
//# sourceMappingURL=index.js.map |
@@ -22,1 +22,4 @@ export declare type FrameData = { | ||
}; | ||
export declare type FlushSync = { | ||
[key in StepId]: () => void; | ||
}; |
{ | ||
"name": "framesync", | ||
"license": "MIT", | ||
"version": "5.2.3", | ||
"version": "5.3.0", | ||
"description": "A frame-synced render loop for JavaScript", | ||
@@ -6,0 +6,0 @@ "author": "Matt Perry", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42511
668