Socket
Socket
Sign inDemoInstall

requestanimationframe-timer

Package Overview
Dependencies
311
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.0.1

11

CHANGELOG.md

@@ -5,2 +5,13 @@ # Change Log

<a name="1.0.1"></a>
## [1.0.1](https://github.com/kambing86/requestanimationframe-timer/compare/v1.0.0...v1.0.1) (2018-01-03)
### Bug Fixes
* change the target to IE 10 to convert down to ES5 ([77c03f2](https://github.com/kambing86/requestanimationframe-timer/commit/77c03f2))
* optimize code ([84630ab](https://github.com/kambing86/requestanimationframe-timer/commit/84630ab))
<a name="1.0.0"></a>

@@ -7,0 +18,0 @@ # 1.0.0 (2018-01-03)

41

dist/index.js

@@ -22,5 +22,7 @@ 'use strict';

function addToRun(id) {
var value = fnStacks.get(id);
runArray.add(value);
function executeFn(value) {
var fn = value.fn,
args = value.args;
fn.apply(undefined, _toConsumableArray(args));
}

@@ -30,14 +32,8 @@

if (runArray.size === 0) return;
runArray.forEach(function (value) {
var fn = value.fn,
args = value.args;
fn.apply(undefined, _toConsumableArray(args));
});
runArray.forEach(executeFn);
runArray.clear();
}
function loop() {
var currentTimeTick = getTimeStamp();
fnStacks.forEach(function (value, id) {
var checkTick = function checkTick(currentTimeTick) {
return function (value, id) {
var nextTick = value.nextTick,

@@ -48,3 +44,3 @@ ms = value.ms,

if (currentTimeTick - nextTick >= 0) {
addToRun(id);
runArray.add(value);
if (mode === MODE_TIMEOUT) {

@@ -58,3 +54,8 @@ fnStacks.delete(id);

}
});
};
};
function loop() {
var currentTimeTick = getTimeStamp();
fnStacks.forEach(checkTick(currentTimeTick));
runFunction();

@@ -78,7 +79,7 @@ if (fnStacks.size === 0) {

fnStacks.set(currentId, {
fn,
ms,
fn: fn,
ms: ms,
nextTick: getTimeStamp() + ms,
args,
mode
args: args,
mode: mode
});

@@ -109,3 +110,3 @@ if (!rafStarted) {

var ms = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
return addId({ fn, ms, args, mode: MODE_TIMEOUT });
return addId({ fn: fn, ms: ms, args: args, mode: MODE_TIMEOUT });
},

@@ -119,5 +120,5 @@ clearTimeout: removeId,

var ms = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
return addId({ fn, ms, args, mode: MODE_INTERVAL });
return addId({ fn: fn, ms: ms, args: args, mode: MODE_INTERVAL });
},
clearInterval: removeId
};
{
"name": "requestanimationframe-timer",
"version": "1.0.0",
"version": "1.0.1",
"description": "",

@@ -5,0 +5,0 @@ "main": "dist/cjs.js",

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc