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

@reactive-js/schedulers

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@reactive-js/schedulers - npm Package Compare versions

Comparing version 0.0.14 to 0.0.15

3

dist/cjs/internal/abstractScheduler.d.ts
import { DisposableLike, DisposableOrTeardown } from "@reactive-js/disposable";
import { SchedulerLike, SchedulerContinuationLike, SchedulerResourceLike } from "@reactive-js/scheduler";
export declare abstract class AbstractScheduler implements SchedulerLike {
private _inScheduledContinuation;
inScheduledContinuation: boolean;
private currentDisposable;

@@ -11,3 +11,2 @@ private startTime;

abstract readonly now: number;
get inScheduledContinuation(): boolean;
private createCallback;

@@ -14,0 +13,0 @@ schedule(continuation: SchedulerContinuationLike, delay?: number): DisposableLike;

@@ -6,3 +6,3 @@ "use strict";

constructor() {
this._inScheduledContinuation = false;
this.inScheduledContinuation = false;
this.currentDisposable = disposable_1.disposed;

@@ -13,5 +13,2 @@ this.startTime = 0;

}
get inScheduledContinuation() {
return this._inScheduledContinuation;
}
createCallback(continuation, disposable) {

@@ -22,5 +19,5 @@ const callback = () => {

this.currentDisposable = disposable;
this._inScheduledContinuation = true;
this.inScheduledContinuation = true;
const result = continuation(this.shouldYield) || undefined;
this._inScheduledContinuation = false;
this.inScheduledContinuation = false;
this.currentDisposable = disposable_1.disposed;

@@ -27,0 +24,0 @@ if (result !== undefined) {

@@ -6,4 +6,4 @@ "use strict";

constructor(compare) {
this.compare = compare;
this.values = [];
this.compare = compare;
}

@@ -10,0 +10,0 @@ get count() {

@@ -15,2 +15,4 @@ "use strict";

constructor(hostScheduler) {
this.hostScheduler = hostScheduler;
this.disposable = disposable_1.createSerialDisposable().add(() => this.queue.clear());
this.queue = priorityQueue_1.createPriorityQueue(comparator);

@@ -73,5 +75,2 @@ this.taskIDCounter = 0;

};
this.disposable = disposable_1.createSerialDisposable();
this.hostScheduler = hostScheduler;
this.disposable.add(() => this.queue.clear());
}

@@ -78,0 +77,0 @@ get inScheduledContinuation() {

@@ -47,11 +47,8 @@ "use strict";

super();
this._now = 0;
this.maxMicroTaskTicks = maxMicroTaskTicks;
this.now = 0;
this.microTaskTicks = 0;
this.taskIDCount = 0;
this.taskQueue = priorityQueue_1.createPriorityQueue(comparator);
this.maxMicroTaskTicks = maxMicroTaskTicks;
}
get now() {
return this._now;
}
shouldCallbackYield(_) {

@@ -78,3 +75,3 @@ this.microTaskTicks++;

const { dueTime, callback, disposable } = task;
this._now = dueTime;
this.now = dueTime;
this.microTaskTicks = 0;

@@ -81,0 +78,0 @@ if (!disposable.isDisposed) {

import { DisposableLike, DisposableOrTeardown } from "@reactive-js/disposable";
import { SchedulerLike, SchedulerContinuationLike, SchedulerResourceLike } from "@reactive-js/scheduler";
export declare abstract class AbstractScheduler implements SchedulerLike {
private _inScheduledContinuation;
inScheduledContinuation: boolean;
private currentDisposable;

@@ -11,3 +11,2 @@ private startTime;

abstract readonly now: number;
get inScheduledContinuation(): boolean;
private createCallback;

@@ -14,0 +13,0 @@ schedule(continuation: SchedulerContinuationLike, delay?: number): DisposableLike;

import { createDisposable, createSerialDisposable, disposed, } from "@reactive-js/disposable";
export class AbstractScheduler {
constructor() {
this._inScheduledContinuation = false;
this.inScheduledContinuation = false;
this.currentDisposable = disposed;

@@ -10,5 +10,2 @@ this.startTime = 0;

}
get inScheduledContinuation() {
return this._inScheduledContinuation;
}
createCallback(continuation, disposable) {

@@ -19,5 +16,5 @@ const callback = () => {

this.currentDisposable = disposable;
this._inScheduledContinuation = true;
this.inScheduledContinuation = true;
const result = continuation(this.shouldYield) || undefined;
this._inScheduledContinuation = false;
this.inScheduledContinuation = false;
this.currentDisposable = disposed;

@@ -24,0 +21,0 @@ if (result !== undefined) {

const computeParentIndex = (index) => Math.floor((index - 1) / 2);
class PriorityQueueImpl {
constructor(compare) {
this.compare = compare;
this.values = [];
this.compare = compare;
}

@@ -7,0 +7,0 @@ get count() {

@@ -13,2 +13,4 @@ import { createDisposable, createSerialDisposable, } from "@reactive-js/disposable";

constructor(hostScheduler) {
this.hostScheduler = hostScheduler;
this.disposable = createSerialDisposable().add(() => this.queue.clear());
this.queue = createPriorityQueue(comparator);

@@ -71,5 +73,2 @@ this.taskIDCounter = 0;

};
this.disposable = createSerialDisposable();
this.hostScheduler = hostScheduler;
this.disposable.add(() => this.queue.clear());
}

@@ -76,0 +75,0 @@ get inScheduledContinuation() {

@@ -44,11 +44,8 @@ import { createDisposable, throwIfDisposed, } from "@reactive-js/disposable";

super();
this._now = 0;
this.maxMicroTaskTicks = maxMicroTaskTicks;
this.now = 0;
this.microTaskTicks = 0;
this.taskIDCount = 0;
this.taskQueue = createPriorityQueue(comparator);
this.maxMicroTaskTicks = maxMicroTaskTicks;
}
get now() {
return this._now;
}
shouldCallbackYield(_) {

@@ -75,3 +72,3 @@ this.microTaskTicks++;

const { dueTime, callback, disposable } = task;
this._now = dueTime;
this.now = dueTime;
this.microTaskTicks = 0;

@@ -78,0 +75,0 @@ if (!disposable.isDisposed) {

import { DisposableLike, DisposableOrTeardown } from "@reactive-js/disposable";
import { SchedulerLike, SchedulerContinuationLike, SchedulerResourceLike } from "@reactive-js/scheduler";
export declare abstract class AbstractScheduler implements SchedulerLike {
private _inScheduledContinuation;
inScheduledContinuation: boolean;
private currentDisposable;

@@ -11,3 +11,2 @@ private startTime;

abstract readonly now: number;
get inScheduledContinuation(): boolean;
private createCallback;

@@ -14,0 +13,0 @@ schedule(continuation: SchedulerContinuationLike, delay?: number): DisposableLike;

{
"name": "@reactive-js/schedulers",
"version": "0.0.14",
"version": "0.0.15",
"main": "dist/cjs/index.js",

@@ -41,4 +41,4 @@ "module": "dist/esm5/index.js",

"dependencies": {
"@reactive-js/disposable": "^0.0.14",
"@reactive-js/scheduler": "^0.0.14"
"@reactive-js/disposable": "^0.0.15",
"@reactive-js/scheduler": "^0.0.15"
},

@@ -70,3 +70,3 @@ "devDependencies": {

},
"gitHead": "8a86dc5efc38fdfe6683765bf2ff3eb14f3820de"
"gitHead": "bb6f825c233fcf3516c7b6ee146d262ac836e5f2"
}

@@ -17,3 +17,5 @@ import {

export abstract class AbstractScheduler implements SchedulerLike {
private _inScheduledContinuation = false;
/** @ignore */
inScheduledContinuation = false;
private currentDisposable: DisposableLike = disposed;

@@ -34,7 +36,2 @@ private startTime = 0;

/** @ignore */
get inScheduledContinuation(): boolean {
return this._inScheduledContinuation;
}
private createCallback(

@@ -48,5 +45,5 @@ continuation: SchedulerContinuationLike,

this.currentDisposable = disposable;
this._inScheduledContinuation = true;
this.inScheduledContinuation = true;
const result = continuation(this.shouldYield) || undefined;
this._inScheduledContinuation = false;
this.inScheduledContinuation = false;
this.currentDisposable = disposed;

@@ -53,0 +50,0 @@

@@ -13,8 +13,6 @@ /** @ignore */

class PriorityQueueImpl<T> implements PriorityQueueLike<T> {
private readonly compare: (a: T, b: T) => number;
private readonly values: Array<T> = [];
constructor(compare: (a: T, b: T) => number) {
this.compare = compare;
}
constructor(private readonly compare: (a: T, b: T) => number) {}
get count(): number {

@@ -21,0 +19,0 @@ return this.values.length;

@@ -50,4 +50,5 @@ import {

class PrioritySchedulerResourceImpl implements PrioritySchedulerResourceLike {
private readonly disposable: SerialDisposableLike;
private readonly hostScheduler: SchedulerLike;
private readonly disposable: SerialDisposableLike = createSerialDisposable().add(
() => this.queue.clear(),
);
private readonly queue: PriorityQueueLike<

@@ -129,8 +130,4 @@ ScheduledTaskLike

};
constructor(hostScheduler: SchedulerLike) {
this.disposable = createSerialDisposable();
this.hostScheduler = hostScheduler;
this.disposable.add(() => this.queue.clear());
}
constructor(private readonly hostScheduler: SchedulerLike) {}

@@ -137,0 +134,0 @@ get inScheduledContinuation(): boolean {

@@ -9,8 +9,6 @@ import { DisposableLike } from "@reactive-js/disposable";

class SchedulerWithPriorityImpl implements SchedulerLike {
private readonly priority: number;
private readonly priorityScheduler: PrioritySchedulerLike;
constructor(priorityScheduler: PrioritySchedulerLike, priority: number) {
this.priorityScheduler = priorityScheduler;
this.priority = priority;
}
constructor(
private readonly priorityScheduler: PrioritySchedulerLike,
private readonly priority: number,
) {}

@@ -17,0 +15,0 @@ public get inScheduledContinuation(): boolean {

@@ -75,4 +75,3 @@ import {

implements VirtualTimeSchedulerResourceLike {
private _now = 0;
private readonly maxMicroTaskTicks: number;
now = 0;
private microTaskTicks = 0;

@@ -83,11 +82,7 @@ private taskIDCount = 0;

> = createPriorityQueue(comparator);
constructor(maxMicroTaskTicks: number) {
constructor(private readonly maxMicroTaskTicks: number) {
super();
this.maxMicroTaskTicks = maxMicroTaskTicks;
}
get now(): number {
return this._now;
}
protected shouldCallbackYield(_: number): boolean {

@@ -119,3 +114,3 @@ this.microTaskTicks++;

this._now = dueTime;
this.now = dueTime;
this.microTaskTicks = 0;

@@ -122,0 +117,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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