@reactive-js/schedulers
Advanced tools
Comparing version 0.0.20 to 0.0.21
export { createPrioritySchedulerResource, PrioritySchedulerLike, PrioritySchedulerResourceLike, } from "./internal/priorityScheduler"; | ||
export { createVirtualTimeSchedulerResource, VirtualTimeSchedulerResourceLike, } from "./internal/virtualTimeScheduler"; | ||
export { createSchedulerWithPriority } from "./internal/schedulerWithPriority"; | ||
export { AbstractScheduler, AbstractSchedulerResource, } from "./internal/abstractScheduler"; | ||
export { SchedulerHost, schedulerMixin } from "./internal/schedulerMixin"; |
@@ -9,5 +9,4 @@ "use strict"; | ||
exports.createSchedulerWithPriority = schedulerWithPriority_1.createSchedulerWithPriority; | ||
var abstractScheduler_1 = require("./internal/abstractScheduler"); | ||
exports.AbstractScheduler = abstractScheduler_1.AbstractScheduler; | ||
exports.AbstractSchedulerResource = abstractScheduler_1.AbstractSchedulerResource; | ||
var schedulerMixin_1 = require("./internal/schedulerMixin"); | ||
exports.schedulerMixin = schedulerMixin_1.schedulerMixin; | ||
//# sourceMappingURL=index.js.map |
@@ -33,2 +33,5 @@ "use strict"; | ||
}; | ||
this.add = disposable_1.disposableMixin.add; | ||
this.dispose = disposable_1.disposableMixin.dispose; | ||
this.remove = disposable_1.disposableMixin.remove; | ||
} | ||
@@ -41,13 +44,2 @@ get isDisposed() { | ||
} | ||
add(disposable, ...disposables) { | ||
this.disposable.add(disposable, ...disposables); | ||
return this; | ||
} | ||
dispose() { | ||
this.disposable.dispose(); | ||
} | ||
remove(disposable, ...disposables) { | ||
this.disposable.remove(disposable, ...disposables); | ||
return this; | ||
} | ||
run(shouldYield) { | ||
@@ -115,5 +107,5 @@ for (let currentTask = this.queue.peek(); currentTask !== undefined; currentTask = this.queue.peek()) { | ||
const head = this.queue.peek(); | ||
if (head === task && this.disposable.disposable.isDisposed) { | ||
if (head === task && this.disposable.inner.isDisposed) { | ||
const delay = Math.max(task.dueTime - this.now, 0); | ||
this.disposable.disposable = this.hostScheduler.schedule(this, delay); | ||
this.disposable.inner = this.hostScheduler.schedule(this, delay); | ||
} | ||
@@ -120,0 +112,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const disposable_1 = require("@reactive-js/disposable"); | ||
const abstractScheduler_1 = require("./abstractScheduler"); | ||
const schedulerMixin_1 = require("./schedulerMixin"); | ||
const priorityQueue_1 = require("./priorityQueue"); | ||
@@ -20,7 +20,7 @@ const iteratorYield = { | ||
}; | ||
class VirtualTimeSchedulerResourceImpl extends abstractScheduler_1.AbstractSchedulerResource { | ||
class VirtualTimeSchedulerResourceImpl { | ||
constructor(maxMicroTaskTicks) { | ||
super(); | ||
this.maxMicroTaskTicks = maxMicroTaskTicks; | ||
this.continuationResult = { continuation: this }; | ||
this.disposable = disposable_1.createDisposable(); | ||
this.microTaskTicks = 0; | ||
@@ -36,3 +36,10 @@ this.now = 0; | ||
}; | ||
this.add = disposable_1.disposableMixin.add; | ||
this.dispose = disposable_1.disposableMixin.dispose; | ||
this.remove = disposable_1.disposableMixin.remove; | ||
this.schedule = schedulerMixin_1.schedulerMixin.schedule; | ||
} | ||
get isDisposed() { | ||
return this.disposable.isDisposed; | ||
} | ||
loop(shouldYield) { | ||
@@ -39,0 +46,0 @@ this.runShouldYield = shouldYield; |
export { createPrioritySchedulerResource, PrioritySchedulerLike, PrioritySchedulerResourceLike, } from "./internal/priorityScheduler"; | ||
export { createVirtualTimeSchedulerResource, VirtualTimeSchedulerResourceLike, } from "./internal/virtualTimeScheduler"; | ||
export { createSchedulerWithPriority } from "./internal/schedulerWithPriority"; | ||
export { AbstractScheduler, AbstractSchedulerResource, } from "./internal/abstractScheduler"; | ||
export { SchedulerHost, schedulerMixin } from "./internal/schedulerMixin"; |
export { createPrioritySchedulerResource, } from "./internal/priorityScheduler"; | ||
export { createVirtualTimeSchedulerResource, } from "./internal/virtualTimeScheduler"; | ||
export { createSchedulerWithPriority } from "./internal/schedulerWithPriority"; | ||
export { AbstractScheduler, AbstractSchedulerResource, } from "./internal/abstractScheduler"; | ||
export { schedulerMixin } from "./internal/schedulerMixin"; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import { createDisposable, createSerialDisposable, } from "@reactive-js/disposable"; | ||
import { createDisposable, createSerialDisposable, disposableMixin, } from "@reactive-js/disposable"; | ||
import { createPriorityQueue } from "./priorityQueue"; | ||
@@ -31,2 +31,5 @@ const comparator = (a, b) => { | ||
}; | ||
this.add = disposableMixin.add; | ||
this.dispose = disposableMixin.dispose; | ||
this.remove = disposableMixin.remove; | ||
} | ||
@@ -39,13 +42,2 @@ get isDisposed() { | ||
} | ||
add(disposable, ...disposables) { | ||
this.disposable.add(disposable, ...disposables); | ||
return this; | ||
} | ||
dispose() { | ||
this.disposable.dispose(); | ||
} | ||
remove(disposable, ...disposables) { | ||
this.disposable.remove(disposable, ...disposables); | ||
return this; | ||
} | ||
run(shouldYield) { | ||
@@ -113,5 +105,5 @@ for (let currentTask = this.queue.peek(); currentTask !== undefined; currentTask = this.queue.peek()) { | ||
const head = this.queue.peek(); | ||
if (head === task && this.disposable.disposable.isDisposed) { | ||
if (head === task && this.disposable.inner.isDisposed) { | ||
const delay = Math.max(task.dueTime - this.now, 0); | ||
this.disposable.disposable = this.hostScheduler.schedule(this, delay); | ||
this.disposable.inner = this.hostScheduler.schedule(this, delay); | ||
} | ||
@@ -118,0 +110,0 @@ } |
@@ -1,3 +0,3 @@ | ||
import { createDisposable, throwIfDisposed, } from "@reactive-js/disposable"; | ||
import { AbstractSchedulerResource } from "./abstractScheduler"; | ||
import { createDisposable, throwIfDisposed, disposableMixin, } from "@reactive-js/disposable"; | ||
import { schedulerMixin } from "./schedulerMixin"; | ||
import { createPriorityQueue } from "./priorityQueue"; | ||
@@ -18,7 +18,7 @@ const iteratorYield = { | ||
}; | ||
class VirtualTimeSchedulerResourceImpl extends AbstractSchedulerResource { | ||
class VirtualTimeSchedulerResourceImpl { | ||
constructor(maxMicroTaskTicks) { | ||
super(); | ||
this.maxMicroTaskTicks = maxMicroTaskTicks; | ||
this.continuationResult = { continuation: this }; | ||
this.disposable = createDisposable(); | ||
this.microTaskTicks = 0; | ||
@@ -34,3 +34,10 @@ this.now = 0; | ||
}; | ||
this.add = disposableMixin.add; | ||
this.dispose = disposableMixin.dispose; | ||
this.remove = disposableMixin.remove; | ||
this.schedule = schedulerMixin.schedule; | ||
} | ||
get isDisposed() { | ||
return this.disposable.isDisposed; | ||
} | ||
loop(shouldYield) { | ||
@@ -37,0 +44,0 @@ this.runShouldYield = shouldYield; |
export { createPrioritySchedulerResource, PrioritySchedulerLike, PrioritySchedulerResourceLike, } from "./internal/priorityScheduler"; | ||
export { createVirtualTimeSchedulerResource, VirtualTimeSchedulerResourceLike, } from "./internal/virtualTimeScheduler"; | ||
export { createSchedulerWithPriority } from "./internal/schedulerWithPriority"; | ||
export { AbstractScheduler, AbstractSchedulerResource, } from "./internal/abstractScheduler"; | ||
export { SchedulerHost, schedulerMixin } from "./internal/schedulerMixin"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -7,7 +7,2 @@ [@reactive-js/schedulers](README.md) | ||
### Classes | ||
* [AbstractScheduler](classes/abstractscheduler.md) | ||
* [AbstractSchedulerResource](classes/abstractschedulerresource.md) | ||
### Interfaces | ||
@@ -17,2 +12,3 @@ | ||
* [PrioritySchedulerResourceLike](interfaces/priorityschedulerresourcelike.md) | ||
* [SchedulerHost](interfaces/schedulerhost.md) | ||
* [VirtualTimeSchedulerResourceLike](interfaces/virtualtimeschedulerresourcelike.md) | ||
@@ -26,2 +22,6 @@ | ||
### Object literals | ||
* [schedulerMixin](README.md#const-schedulermixin) | ||
## Functions | ||
@@ -69,1 +69,21 @@ | ||
**Returns:** *[VirtualTimeSchedulerResourceLike](interfaces/virtualtimeschedulerresourcelike.md)* | ||
## Object literals | ||
### `Const` schedulerMixin | ||
### ▪ **schedulerMixin**: *object* | ||
### schedule | ||
▸ **schedule**(`this`: [SchedulerHost](interfaces/schedulerhost.md), `continuation`: SchedulerContinuationLike, `delay`: number): *DisposableLike* | ||
**Parameters:** | ||
Name | Type | Default | | ||
------ | ------ | ------ | | ||
`this` | [SchedulerHost](interfaces/schedulerhost.md) | - | | ||
`continuation` | SchedulerContinuationLike | - | | ||
`delay` | number | 0 | | ||
**Returns:** *DisposableLike* |
{ | ||
"name": "@reactive-js/schedulers", | ||
"version": "0.0.20", | ||
"version": "0.0.21", | ||
"main": "dist/cjs/index.js", | ||
@@ -41,4 +41,4 @@ "module": "dist/esm5/index.js", | ||
"dependencies": { | ||
"@reactive-js/disposable": "^0.0.20", | ||
"@reactive-js/scheduler": "^0.0.20" | ||
"@reactive-js/disposable": "^0.0.21", | ||
"@reactive-js/scheduler": "^0.0.21" | ||
}, | ||
@@ -70,3 +70,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "d78cd2b94c3a6a1a4eac41b8c9ca81bd9b98167d" | ||
"gitHead": "3457dad433e17a7335b6c9ba083762ea3ad6ef31" | ||
} |
@@ -14,5 +14,2 @@ export { | ||
export { | ||
AbstractScheduler, | ||
AbstractSchedulerResource, | ||
} from "./internal/abstractScheduler"; | ||
export { SchedulerHost, schedulerMixin } from "./internal/schedulerMixin"; |
@@ -5,3 +5,3 @@ import { | ||
DisposableLike, | ||
DisposableOrTeardown, | ||
disposableMixin, | ||
SerialDisposableLike, | ||
@@ -50,4 +50,4 @@ } from "@reactive-js/disposable"; | ||
implements PrioritySchedulerResourceLike, SchedulerContinuationLike { | ||
private readonly disposable: SerialDisposableLike = createSerialDisposable().add( | ||
() => this.queue.clear(), | ||
readonly disposable: SerialDisposableLike = createSerialDisposable().add(() => | ||
this.queue.clear(), | ||
); | ||
@@ -81,2 +81,8 @@ private readonly queue: PriorityQueueLike< | ||
/** @ignore */ | ||
add = disposableMixin.add; | ||
/** @ignore */ | ||
dispose = disposableMixin.dispose; | ||
/** @ignore */ | ||
remove = disposableMixin.remove; | ||
constructor(private readonly hostScheduler: SchedulerLike) {} | ||
@@ -92,22 +98,2 @@ | ||
add( | ||
disposable: DisposableOrTeardown, | ||
...disposables: DisposableOrTeardown[] | ||
) { | ||
this.disposable.add(disposable, ...disposables); | ||
return this; | ||
} | ||
dispose() { | ||
this.disposable.dispose(); | ||
} | ||
remove( | ||
disposable: DisposableOrTeardown, | ||
...disposables: DisposableOrTeardown[] | ||
) { | ||
this.disposable.remove(disposable, ...disposables); | ||
return this; | ||
} | ||
run(shouldYield?: () => boolean) { | ||
@@ -195,6 +181,6 @@ for ( | ||
const head = this.queue.peek(); | ||
if (head === task && this.disposable.disposable.isDisposed) { | ||
if (head === task && this.disposable.inner.isDisposed) { | ||
const delay = Math.max(task.dueTime - this.now, 0); | ||
this.disposable.disposable = this.hostScheduler.schedule(this, delay); | ||
this.disposable.inner = this.hostScheduler.schedule(this, delay); | ||
} | ||
@@ -201,0 +187,0 @@ } |
@@ -5,2 +5,3 @@ import { | ||
throwIfDisposed, | ||
disposableMixin, | ||
} from "@reactive-js/disposable"; | ||
@@ -12,3 +13,3 @@ import { | ||
} from "@reactive-js/scheduler"; | ||
import { AbstractSchedulerResource } from "./abstractScheduler"; | ||
import { schedulerMixin } from "./schedulerMixin"; | ||
import { createPriorityQueue, PriorityQueueLike } from "./priorityQueue"; | ||
@@ -46,5 +47,6 @@ | ||
class VirtualTimeSchedulerResourceImpl extends AbstractSchedulerResource | ||
class VirtualTimeSchedulerResourceImpl | ||
implements VirtualTimeSchedulerResourceLike { | ||
private readonly continuationResult = { continuation: this }; | ||
readonly disposable: DisposableLike = createDisposable(); | ||
private microTaskTicks = 0; | ||
@@ -67,4 +69,10 @@ now = 0; | ||
constructor(private readonly maxMicroTaskTicks: number) { | ||
super(); | ||
add = disposableMixin.add; | ||
dispose = disposableMixin.dispose; | ||
remove = disposableMixin.remove; | ||
schedule = schedulerMixin.schedule; | ||
constructor(private readonly maxMicroTaskTicks: number) {} | ||
get isDisposed() { | ||
return this.disposable.isDisposed; | ||
} | ||
@@ -129,3 +137,3 @@ | ||
protected scheduleCallback(callback: () => void, delay = 0): DisposableLike { | ||
scheduleCallback(callback: () => void, delay = 0): DisposableLike { | ||
const disposable = createDisposable(); | ||
@@ -132,0 +140,0 @@ const work: VirtualTask = { |
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
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
419691
71
1388
+ Added@reactive-js/disposable@0.0.21(transitive)
+ Added@reactive-js/scheduler@0.0.21(transitive)
- Removed@reactive-js/disposable@0.0.20(transitive)
- Removed@reactive-js/scheduler@0.0.20(transitive)