Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

framesync

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

framesync - npm Package Compare versions

Comparing version 5.0.0 to 5.1.0

8

CHANGELOG.md

@@ -5,4 +5,10 @@ # Changelog

## [5.0.0] Unreleased
## [5.1.0] 2021-02-22
### Fixed
- Adding polyfill for `performance.now` for better compatibility with Node environments.
## [5.0.0] 2021-01-01
### Changed

@@ -9,0 +15,0 @@

var defaultTimestep = 1 / 60 * 1000;
var getCurrentTime = typeof performance !== "undefined" ? function () {
return performance.now();
} : function () {
return Date.now();
};
var onNextFrame = typeof window !== "undefined" ? function (callback) {

@@ -6,3 +11,3 @@ return window.requestAnimationFrame(callback);

return setTimeout(function () {
return callback(performance.now());
return callback(getCurrentTime());
}, defaultTimestep);

@@ -9,0 +14,0 @@ };

5

dist/framesync.js

@@ -8,2 +8,5 @@ (function (global, factory) {

var defaultTimestep = (1 / 60) * 1000;
var getCurrentTime = typeof performance !== "undefined"
? function () { return performance.now(); }
: function () { return Date.now(); };
var onNextFrame = typeof window !== "undefined"

@@ -14,3 +17,3 @@ ? function (callback) {

: function (callback) {
return setTimeout(function () { return callback(performance.now()); }, defaultTimestep);
return setTimeout(function () { return callback(getCurrentTime()); }, defaultTimestep);
};

@@ -17,0 +20,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=e||self).framesync={})}(this,function(e){"use strict";var n=1/60*1e3,t="undefined"!=typeof window?function(e){return window.requestAnimationFrame(e)}:function(e){return setTimeout(function(){return e(performance.now())},n)};function r(e){return f[e].process(i)}var u=!0,s=!1,o=!1,i={delta:0,timestamp:0},c=["read","update","preRender","render","postRender"],f=c.reduce(function(e,n){var u,o,i,c,f,a,d;return e[n]=(u=function(){return s=!0},o=[],c=0,f=!(i=[]),a=new WeakSet,d={schedule:function(e,n,t){void 0===n&&(n=!1),void 0===t&&(t=!1);var r=t&&f,t=r?o:i;return n&&a.add(e),-1===t.indexOf(e)&&(t.push(e),r&&f&&(c=o.length)),e},cancel:function(e){var n=i.indexOf(e);-1!==n&&i.splice(n,1),a.delete(e)},process:function(e){var n;if(f=!0,o=(n=[i,o])[0],(i=n[1]).length=0,c=o.length)for(var t=0;t<c;t++){var r=o[t];r(e),a.has(r)&&(d.schedule(r),u())}f=!1}}),e},{}),a=c.reduce(function(e,n){var r=f[n];return e[n]=function(e,n,t){return void 0===n&&(n=!1),void 0===t&&(t=!1),s||l(),r.schedule(e,n,t)},e},{}),d=c.reduce(function(e,n){return e[n]=f[n].cancel,e},{}),p=function(e){s=!1,i.delta=u?n:Math.max(Math.min(e-i.timestamp,40),1),i.timestamp=e,o=!0,c.forEach(r),o=!1,s&&(u=!1,t(p))},l=function(){u=s=!0,o||t(p)};e.cancelSync=d,e.default=a,e.getFrameData=function(){return i},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=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)};function u(e){return a[e].process(c)}var o=!0,s=!1,i=!1,c={delta:0,timestamp:0},f=["read","update","preRender","render","postRender"],a=f.reduce(function(e,n){var u,o,i,c,f,a,d;return e[n]=(u=function(){return s=!0},o=[],c=0,f=!(i=[]),a=new WeakSet,d={schedule:function(e,n,t){void 0===n&&(n=!1),void 0===t&&(t=!1);var r=t&&f,t=r?o:i;return n&&a.add(e),-1===t.indexOf(e)&&(t.push(e),r&&f&&(c=o.length)),e},cancel:function(e){var n=i.indexOf(e);-1!==n&&i.splice(n,1),a.delete(e)},process:function(e){var n;if(f=!0,o=(n=[i,o])[0],(i=n[1]).length=0,c=o.length)for(var t=0;t<c;t++){var r=o[t];r(e),a.has(r)&&(d.schedule(r),u())}f=!1}}),e},{}),d=f.reduce(function(e,n){var r=a[n];return e[n]=function(e,n,t){return void 0===n&&(n=!1),void 0===t&&(t=!1),s||m(),r.schedule(e,n,t)},e},{}),p=f.reduce(function(e,n){return e[n]=a[n].cancel,e},{}),l=function(e){s=!1,c.delta=o?n:Math.max(Math.min(e-c.timestamp,40),1),c.timestamp=e,i=!0,f.forEach(u),i=!1,s&&(o=!1,r(l))},m=function(){o=s=!0,i||r(l)};e.cancelSync=p,e.default=d,e.getFrameData=function(){return c},Object.defineProperty(e,"__esModule",{value:!0})});

@@ -6,2 +6,5 @@ 'use strict';

var defaultTimestep = (1 / 60) * 1000;
var getCurrentTime = typeof performance !== "undefined"
? function () { return performance.now(); }
: function () { return Date.now(); };
var onNextFrame = typeof window !== "undefined"

@@ -12,3 +15,3 @@ ? function (callback) {

: function (callback) {
return setTimeout(function () { return callback(performance.now()); }, defaultTimestep);
return setTimeout(function () { return callback(getCurrentTime()); }, defaultTimestep);
};

@@ -15,0 +18,0 @@

{
"name": "framesync",
"version": "5.0.0",
"version": "5.1.0",
"description": "A frame-synced render loop for JavaScript",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc