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

frame-scheduling

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

frame-scheduling - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

10

lib/frameScheduling.js

@@ -38,7 +38,5 @@ "use strict";

LinkedList.prototype.shift = function () {
if (this.length === 0 || !this.head) {
return;
}
var value = this.head.value;
this.head = this.head.next;
var currentHead = this.head;
var value = currentHead.value;
this.head = currentHead.next;
this.length--;

@@ -102,3 +100,3 @@ return value;

try {
job && job();
job();
}

@@ -105,0 +103,0 @@ catch (e) {

11

package.json
{
"name": "frame-scheduling",
"version": "0.4.0",
"version": "0.4.1",
"description": "Asynchronous start of functions in JS. Supports priority and interrupt execution every 16 milliseconds, to achieve 60fps.",

@@ -10,3 +10,5 @@ "main": "lib/frameScheduling.js",

"test": "jest",
"test:watch": "jest --watch"
"test:coverage": "jest --coverage",
"test:watch": "jest --watch",
"cli": "npm run test:coverage && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js"
},

@@ -29,5 +31,6 @@ "repository": {

"transform": {
"^.+\\.ts$": "<rootDir>/preprocessor.js"
"^.+\\.ts$": "<rootDir>/node_modules/ts-jest/preprocessor.js"
},
"timers": "fake",
"mapCoverage": true,
"testMatch": [

@@ -41,4 +44,6 @@ "<rootDir>/tests/**/*.(ts|js)"

"@types/node": "^8.0.46",
"coveralls": "^3.0.0",
"jest": "^21.2.1",
"prettier": "1.7.4",
"ts-jest": "^21.1.4",
"tslint": "^5.8.0",

@@ -45,0 +50,0 @@ "typescript": "^2.5.3"

# Frame Scheduling
[![Build Status](https://travis-ci.org/Tom910/frame-scheduling.svg?branch=master)](https://travis-ci.org/Tom910/frame-scheduling)
[![Coverage Status](https://coveralls.io/repos/github/Tom910/frame-scheduling/badge.svg?branch=master)](https://coveralls.io/github/Tom910/frame-scheduling?branch=master)
```js

@@ -4,0 +7,0 @@ import frameScheduling, { P_IMPORTANT } from 'frame-scheduling';

@@ -51,9 +51,6 @@ const context = typeof window !== "undefined" ? window : global;

shift() {
if (this.length === 0 || !this.head) {
return;
}
const currentHead = <listNode>this.head;
const value = currentHead.value;
const value = this.head.value;
this.head = this.head.next;
this.head = currentHead.next;
this.length--;

@@ -133,3 +130,3 @@

try {
job && job();
job();
} catch (e) {

@@ -136,0 +133,0 @@ console.error(e);

@@ -23,7 +23,2 @@ import frameScheduling, { P_LOW, P_HIGH } from "../src/frameScheduling";

declare namespace setTimeout {
function mockClear(): void;
let mock: jest.MockContext<{}>;
}
describe("frameScheduling", () => {

@@ -34,3 +29,3 @@ const originDateNow = Date.now.bind(Date);

beforeEach(() => {
setTimeout.mockClear();
(<any>setTimeout).mockClear();
});

@@ -57,3 +52,3 @@

expect(setTimeout.mock.calls.length).toBe(1);
expect((<any>setTimeout).mock.calls.length).toBe(1);
expect(counter).toBe(3);

@@ -81,3 +76,3 @@ });

expect(setTimeout.mock.calls.length).toBe(4);
expect((<any>setTimeout).mock.calls.length).toBe(4);
expect(counter).toBe(4);

@@ -113,3 +108,3 @@ });

expect(setTimeout.mock.calls.length).toBe(1);
expect((<any>setTimeout).mock.calls.length).toBe(1);
expect(result).toEqual(["React", "Angular", "Vue", "Ember"]);

@@ -166,4 +161,25 @@ });

expect(result).toEqual(5);
expect(setTimeout.mock.calls.length).toBe(1);
expect((<any>setTimeout).mock.calls.length).toBe(1);
});
it("Run different defer modes", () => {
jest.resetModules();
const originWindow = global["window"];
delete global["window"];
global["requestAnimationFrame"] = fn => setTimeout(fn, 0);
const scheduling = require("../src/frameScheduling");
let result = 0;
frameScheduling(() => (result += 2));
jest.runAllTimers();
delete global["requestAnimationFrame"];
global["window"] = originWindow;
expect(result).toBe(2);
});
});

Sorry, the diff of this file is not supported yet

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