New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@most/scheduler

Package Overview
Dependencies
Maintainers
4
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@most/scheduler - npm Package Compare versions

Comparing version 0.7.0 to 0.7.1

24

dist/index.es.js

@@ -373,9 +373,9 @@ /** @license MIT License (c) copyright 2010-2016 original author or authors */

var MillisecondClock = function MillisecondClock (now, origin) {
var RelativeClock = function RelativeClock (clock, origin) {
this.origin = origin;
this._now = now;
this.clock = clock;
};
MillisecondClock.prototype.now = function now () {
return this._now() - this.origin
RelativeClock.prototype.now = function now () {
return this.clock.now() - this.origin
};

@@ -385,15 +385,15 @@

this.origin = origin;
this._hrtime = hrtime;
this.hrtime = hrtime;
};
HRTimeClock.prototype.now = function now () {
var hrt = this._hrtime(this.origin);
var hrt = this.hrtime(this.origin);
return (hrt[0] * 1e9 + hrt[1]) / 1e6
};
var millisecondClockFromNow = function (now) { return new MillisecondClock(now, now()); };
var clockRelativeTo = function (clock) { return new RelativeClock(clock, clock.now()); };
var newPerformanceNowClock = function () { return millisecondClockFromNow(performance.now); };
var newPerformanceClock = function () { return clockRelativeTo(performance); };
var newDateNowClock = function () { return millisecondClockFromNow(Date.now); };
var newDateClock = function () { return clockRelativeTo(Date); };

@@ -404,3 +404,3 @@ var newHRTimeClock = function () { return new HRTimeClock(process.hrtime, process.hrtime()); };

if (typeof performance !== 'undefined' && typeof performance.now === 'function') {
return newPerformanceNowClock()
return newPerformanceClock()
} else if (typeof process !== 'undefined' && typeof process.hrtime === 'function') {

@@ -410,3 +410,3 @@ return newHRTimeClock()

return newDateNowClock()
return newDateClock()
};

@@ -425,3 +425,3 @@

export { newScheduler, newDefaultScheduler, newDefaultTimer, newClockTimer, newTimeline, MillisecondClock, HRTimeClock, millisecondClockFromNow, newPerformanceNowClock, newDateNowClock, newHRTimeClock, newPlatformClock };
export { newScheduler, newDefaultScheduler, newDefaultTimer, newClockTimer, newTimeline, RelativeClock, HRTimeClock, clockRelativeTo, newPerformanceClock, newDateClock, newHRTimeClock, newPlatformClock };
//# sourceMappingURL=index.es.js.map

@@ -379,9 +379,9 @@ (function (global, factory) {

var MillisecondClock = function MillisecondClock (now, origin) {
var RelativeClock = function RelativeClock (clock, origin) {
this.origin = origin;
this._now = now;
this.clock = clock;
};
MillisecondClock.prototype.now = function now () {
return this._now() - this.origin
RelativeClock.prototype.now = function now () {
return this.clock.now() - this.origin
};

@@ -391,15 +391,15 @@

this.origin = origin;
this._hrtime = hrtime;
this.hrtime = hrtime;
};
HRTimeClock.prototype.now = function now () {
var hrt = this._hrtime(this.origin);
var hrt = this.hrtime(this.origin);
return (hrt[0] * 1e9 + hrt[1]) / 1e6
};
var millisecondClockFromNow = function (now) { return new MillisecondClock(now, now()); };
var clockRelativeTo = function (clock) { return new RelativeClock(clock, clock.now()); };
var newPerformanceNowClock = function () { return millisecondClockFromNow(performance.now); };
var newPerformanceClock = function () { return clockRelativeTo(performance); };
var newDateNowClock = function () { return millisecondClockFromNow(Date.now); };
var newDateClock = function () { return clockRelativeTo(Date); };

@@ -410,3 +410,3 @@ var newHRTimeClock = function () { return new HRTimeClock(process.hrtime, process.hrtime()); };

if (typeof performance !== 'undefined' && typeof performance.now === 'function') {
return newPerformanceNowClock()
return newPerformanceClock()
} else if (typeof process !== 'undefined' && typeof process.hrtime === 'function') {

@@ -416,3 +416,3 @@ return newHRTimeClock()

return newDateNowClock()
return newDateClock()
};

@@ -436,7 +436,7 @@

exports.newTimeline = newTimeline;
exports.MillisecondClock = MillisecondClock;
exports.RelativeClock = RelativeClock;
exports.HRTimeClock = HRTimeClock;
exports.millisecondClockFromNow = millisecondClockFromNow;
exports.newPerformanceNowClock = newPerformanceNowClock;
exports.newDateNowClock = newDateNowClock;
exports.clockRelativeTo = clockRelativeTo;
exports.newPerformanceClock = newPerformanceClock;
exports.newDateClock = newDateClock;
exports.newHRTimeClock = newHRTimeClock;

@@ -443,0 +443,0 @@ exports.newPlatformClock = newPlatformClock;

@@ -1,1 +0,1 @@

(function(t,e){typeof exports==="object"&&typeof module!=="undefined"?e(exports):typeof define==="function"&&define.amd?define(["exports"],e):e(t.mostCore=t.mostCore||{})})(this,function(t){"use strict";function e(t,e){var n=e.length;var r=new Array(n);var i=0;for(var o,s=0;s<n;++s){o=e[s];if(!t(o)){r[i]=o;++i}}r.length=i;return r}function n(t,e){for(var n=0,r=e.length;n<r;++n){if(t===e[n]){return n}}return-1}function r(t){function e(n,r){switch(arguments.length){case 0:return e;case 1:return function(e){return t(n,e)};default:return t(n,r)}}return e}function i(t,e,n,r){this.time=t;this.period=e;this.task=n;this.scheduler=r;this.active=true}i.prototype.run=function(){return this.task.run(this.time)};i.prototype.error=function(t){return this.task.error(this.time,t)};i.prototype.dispose=function(){this.scheduler.cancel(this);return this.task.dispose()};var o=function(t){return Promise.resolve(t).then(s)};function s(t){try{return t.run()}catch(e){return t.error(e)}}var u=function t(e,n){var r=this;this.timer=e;this.timeline=n;this._timer=null;this._nextArrival=Infinity;this._runReadyTasksBound=function(){return r._runReadyTasks(r.now())}};u.prototype.now=function t(){return this.timer.now()};u.prototype.asap=function t(e){return this.schedule(0,-1,e)};u.prototype.delay=function t(e,n){return this.schedule(e,-1,n)};u.prototype.periodic=function t(e,n){return this.schedule(0,e,n)};u.prototype.schedule=function t(e,n,r){var o=this.now();var s=new i(o+Math.max(0,e),n,r,this);this.timeline.add(s);this._scheduleNextRun(o);return s};u.prototype.cancel=function t(e){e.active=false;if(this.timeline.remove(e)){this._reschedule()}};u.prototype.cancelAll=function t(e){this.timeline.removeAll(e);this._reschedule()};u.prototype._reschedule=function t(){if(this.timeline.isEmpty()){this._unschedule()}else{this._scheduleNextRun(this.now())}};u.prototype._unschedule=function t(){this.timer.clearTimer(this._timer);this._timer=null};u.prototype._scheduleNextRun=function t(e){if(this.timeline.isEmpty()){return}var n=this.timeline.nextArrival();if(this._timer===null){this._scheduleNextArrival(n,e)}else if(n<this._nextArrival){this._unschedule();this._scheduleNextArrival(n,e)}};u.prototype._scheduleNextArrival=function t(e,n){this._nextArrival=e;var r=Math.max(0,e-n);this._timer=this.timer.setTimer(this._runReadyTasksBound,r)};u.prototype._runReadyTasks=function t(e){this._timer=null;this.timeline.runTasks(e,s);this._scheduleNextRun(this.now())};var c=function t(){this.tasks=[]};c.prototype.nextArrival=function t(){return this.isEmpty()?Infinity:this.tasks[0].time};c.prototype.isEmpty=function t(){return this.tasks.length===0};c.prototype.add=function t(e){a(e,this.tasks)};c.prototype.remove=function t(e){var r=d(v(e),this.tasks);if(r>=0&&r<this.tasks.length){var i=n(e,this.tasks[r].events);if(i>=0){this.tasks[r].events.splice(i,1);return true}}return false};c.prototype.removeAll=function t(e){var n=this;for(var r=0;r<this.tasks.length;++r){m(e,n.tasks[r])}};c.prototype.runTasks=function t(e,n){var r=this;var i=this.tasks;var o=i.length;var s=0;while(s<o&&i[s].time<=e){++s}this.tasks=i.slice(s);for(var u=0;u<s;++u){r.tasks=h(n,i[u].events,r.tasks)}};function h(t,e,n){for(var r=0;r<e.length;++r){var i=e[r];if(i.active){t(i);if(i.period>=0&&i.active){i.time=i.time+i.period;a(i,n)}}}return n}function a(t,e){var n=e.length;var r=v(t);if(n===0){e.push(y(r,[t]));return}var i=d(r,e);if(i>=n){e.push(y(r,[t]))}else{f(t,e,r,i)}}function f(t,e,n,r){var i=e[r];if(n===i.time){l(t,i.events,n)}else{e.splice(r,0,y(n,[t]))}}function l(t,e){if(e.length===0||t.time>=e[e.length-1].time){e.push(t)}else{p(t,e)}}function p(t,e){for(var n=0;n<e.length;n++){if(t.time<e[n].time){e.splice(n,0,t);break}}}function v(t){return Math.floor(t.time)}function m(t,n){n.events=e(t,n.events)}function d(t,e){var n=0;var r=e.length;var i,o;while(n<r){i=Math.floor((n+r)/2);o=e[i];if(t===o.time){return i}else if(t<o.time){r=i}else{n=i+1}}return r}var y=function(t,e){return{time:t,events:e}};var w=function t(e){this._clock=e};w.prototype.now=function t(){return this._clock.now()};w.prototype.setTimer=function t(e,n){return n<=0?_(e):setTimeout(e,n)};w.prototype.clearTimer=function t(e){return e instanceof k?e.cancel():clearTimeout(e)};var k=function t(e){this.f=e;this.active=true};k.prototype.run=function t(){return this.active&&this.f()};k.prototype.error=function t(e){throw e};k.prototype.cancel=function t(){this.active=false};function _(t){var e=new k(t);o(e);return e}var g=function t(e,n){this.origin=n;this._now=e};g.prototype.now=function t(){return this._now()-this.origin};var x=function t(e,n){this.origin=n;this._hrtime=e};x.prototype.now=function t(){var e=this._hrtime(this.origin);return(e[0]*1e9+e[1])/1e6};var T=function(t){return new g(t,t())};var A=function(){return T(performance.now)};var C=function(){return T(Date.now)};var N=function(){return new x(process.hrtime,process.hrtime())};var R=function(){if(typeof performance!=="undefined"&&typeof performance.now==="function"){return A()}else if(typeof process!=="undefined"&&typeof process.hrtime==="function"){return N()}return C()};var M=r(function(t,e){return new u(t,e)});var D=function(){return new u(E(),new c)};var E=function(){return new w(R())};var P=function(t){return new w(t)};var b=function(){return new c};t.newScheduler=M;t.newDefaultScheduler=D;t.newDefaultTimer=E;t.newClockTimer=P;t.newTimeline=b;t.MillisecondClock=g;t.HRTimeClock=x;t.millisecondClockFromNow=T;t.newPerformanceNowClock=A;t.newDateNowClock=C;t.newHRTimeClock=N;t.newPlatformClock=R;Object.defineProperty(t,"__esModule",{value:true})});
(function(t,e){typeof exports==="object"&&typeof module!=="undefined"?e(exports):typeof define==="function"&&define.amd?define(["exports"],e):e(t.mostCore=t.mostCore||{})})(this,function(t){"use strict";function e(t,e){var n=e.length;var r=new Array(n);var i=0;for(var o,s=0;s<n;++s){o=e[s];if(!t(o)){r[i]=o;++i}}r.length=i;return r}function n(t,e){for(var n=0,r=e.length;n<r;++n){if(t===e[n]){return n}}return-1}function r(t){function e(n,r){switch(arguments.length){case 0:return e;case 1:return function(e){return t(n,e)};default:return t(n,r)}}return e}function i(t,e,n,r){this.time=t;this.period=e;this.task=n;this.scheduler=r;this.active=true}i.prototype.run=function(){return this.task.run(this.time)};i.prototype.error=function(t){return this.task.error(this.time,t)};i.prototype.dispose=function(){this.scheduler.cancel(this);return this.task.dispose()};var o=function(t){return Promise.resolve(t).then(s)};function s(t){try{return t.run()}catch(e){return t.error(e)}}var u=function t(e,n){var r=this;this.timer=e;this.timeline=n;this._timer=null;this._nextArrival=Infinity;this._runReadyTasksBound=function(){return r._runReadyTasks(r.now())}};u.prototype.now=function t(){return this.timer.now()};u.prototype.asap=function t(e){return this.schedule(0,-1,e)};u.prototype.delay=function t(e,n){return this.schedule(e,-1,n)};u.prototype.periodic=function t(e,n){return this.schedule(0,e,n)};u.prototype.schedule=function t(e,n,r){var o=this.now();var s=new i(o+Math.max(0,e),n,r,this);this.timeline.add(s);this._scheduleNextRun(o);return s};u.prototype.cancel=function t(e){e.active=false;if(this.timeline.remove(e)){this._reschedule()}};u.prototype.cancelAll=function t(e){this.timeline.removeAll(e);this._reschedule()};u.prototype._reschedule=function t(){if(this.timeline.isEmpty()){this._unschedule()}else{this._scheduleNextRun(this.now())}};u.prototype._unschedule=function t(){this.timer.clearTimer(this._timer);this._timer=null};u.prototype._scheduleNextRun=function t(e){if(this.timeline.isEmpty()){return}var n=this.timeline.nextArrival();if(this._timer===null){this._scheduleNextArrival(n,e)}else if(n<this._nextArrival){this._unschedule();this._scheduleNextArrival(n,e)}};u.prototype._scheduleNextArrival=function t(e,n){this._nextArrival=e;var r=Math.max(0,e-n);this._timer=this.timer.setTimer(this._runReadyTasksBound,r)};u.prototype._runReadyTasks=function t(e){this._timer=null;this.timeline.runTasks(e,s);this._scheduleNextRun(this.now())};var c=function t(){this.tasks=[]};c.prototype.nextArrival=function t(){return this.isEmpty()?Infinity:this.tasks[0].time};c.prototype.isEmpty=function t(){return this.tasks.length===0};c.prototype.add=function t(e){a(e,this.tasks)};c.prototype.remove=function t(e){var r=d(v(e),this.tasks);if(r>=0&&r<this.tasks.length){var i=n(e,this.tasks[r].events);if(i>=0){this.tasks[r].events.splice(i,1);return true}}return false};c.prototype.removeAll=function t(e){var n=this;for(var r=0;r<this.tasks.length;++r){m(e,n.tasks[r])}};c.prototype.runTasks=function t(e,n){var r=this;var i=this.tasks;var o=i.length;var s=0;while(s<o&&i[s].time<=e){++s}this.tasks=i.slice(s);for(var u=0;u<s;++u){r.tasks=h(n,i[u].events,r.tasks)}};function h(t,e,n){for(var r=0;r<e.length;++r){var i=e[r];if(i.active){t(i);if(i.period>=0&&i.active){i.time=i.time+i.period;a(i,n)}}}return n}function a(t,e){var n=e.length;var r=v(t);if(n===0){e.push(y(r,[t]));return}var i=d(r,e);if(i>=n){e.push(y(r,[t]))}else{f(t,e,r,i)}}function f(t,e,n,r){var i=e[r];if(n===i.time){l(t,i.events,n)}else{e.splice(r,0,y(n,[t]))}}function l(t,e){if(e.length===0||t.time>=e[e.length-1].time){e.push(t)}else{p(t,e)}}function p(t,e){for(var n=0;n<e.length;n++){if(t.time<e[n].time){e.splice(n,0,t);break}}}function v(t){return Math.floor(t.time)}function m(t,n){n.events=e(t,n.events)}function d(t,e){var n=0;var r=e.length;var i,o;while(n<r){i=Math.floor((n+r)/2);o=e[i];if(t===o.time){return i}else if(t<o.time){r=i}else{n=i+1}}return r}var y=function(t,e){return{time:t,events:e}};var k=function t(e){this._clock=e};k.prototype.now=function t(){return this._clock.now()};k.prototype.setTimer=function t(e,n){return n<=0?_(e):setTimeout(e,n)};k.prototype.clearTimer=function t(e){return e instanceof w?e.cancel():clearTimeout(e)};var w=function t(e){this.f=e;this.active=true};w.prototype.run=function t(){return this.active&&this.f()};w.prototype.error=function t(e){throw e};w.prototype.cancel=function t(){this.active=false};function _(t){var e=new w(t);o(e);return e}var g=function t(e,n){this.origin=n;this.clock=e};g.prototype.now=function t(){return this.clock.now()-this.origin};var T=function t(e,n){this.origin=n;this.hrtime=e};T.prototype.now=function t(){var e=this.hrtime(this.origin);return(e[0]*1e9+e[1])/1e6};var x=function(t){return new g(t,t.now())};var A=function(){return x(performance)};var R=function(){return x(Date)};var C=function(){return new T(process.hrtime,process.hrtime())};var N=function(){if(typeof performance!=="undefined"&&typeof performance.now==="function"){return A()}else if(typeof process!=="undefined"&&typeof process.hrtime==="function"){return C()}return R()};var M=r(function(t,e){return new u(t,e)});var D=function(){return new u(E(),new c)};var E=function(){return new k(N())};var P=function(t){return new k(t)};var b=function(){return new c};t.newScheduler=M;t.newDefaultScheduler=D;t.newDefaultTimer=E;t.newClockTimer=P;t.newTimeline=b;t.RelativeClock=g;t.HRTimeClock=T;t.clockRelativeTo=x;t.newPerformanceClock=A;t.newDateClock=R;t.newHRTimeClock=C;t.newPlatformClock=N;Object.defineProperty(t,"__esModule",{value:true})});
{
"name": "@most/scheduler",
"version": "0.7.0",
"version": "0.7.1",
"description": "Reactive programming with lean, functions-only, curried, tree-shakeable API",

@@ -5,0 +5,0 @@ "typings": "type-definitions/index.d.ts",

import { Scheduler, Timeline, Timer, Time } from '@most/types';
export type Now = () => Time;
export type Clock = {
now: Now
now: () => Time
};

@@ -18,5 +16,5 @@

export function newPlatformClock (): Clock;
export function millisecondClockFromNow (now: Now): Clock;
export function newPerformanceNowClock (): Clock;
export function newDateNowClock (): Clock;
export function newPerformanceClock (): Clock;
export function newDateClock (): Clock;
export function newHRTimeClock (): Clock;
export function clockRelativeTo (clock: Clock): Clock;

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