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

hypertimer

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hypertimer - npm Package Compare versions

Comparing version 2.0.1 to 2.1.0

examples/synchronization/master.js

6

dist/hypertimer.min.js

@@ -9,4 +9,4 @@ /**

*
* @version 2.0.1
* @date 2015-02-19
* @version 2.1.0
* @date 2015-02-27
*

@@ -28,3 +28,3 @@ * @license

*/
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):"object"==typeof exports?exports.hypertimer=t():e.hypertimer=t()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){e.exports=r(1)},function(e,t,r){function n(e){function t(e){if(d.length>0){for(var t=d.length-1;t>=0&&d[t].time>e.time;)t--;d.splice(t+1,0,e)}else d.push(e)}function r(e,r){function n(){e.type===o.INTERVAL&&v[e.id]&&(e.occurrence++,e.time=e.firstTime+e.occurrence*e.interval,t(e)),delete v[e.id],r&&r()}v[e.id]=e;try{0==e.callback.length?(e.callback(),n()):e.callback(n)}catch(i){n()}}function n(e){for(var t=0;t<d.length&&(d[t].time<=e||!isFinite(d[t].time));)t++;var r=d.splice(0,t);return 0==f&&i.shuffle(r),r}function u(){function e(){function e(){var n=t.shift();n?r(n,e):u()}a||(p=i>p&&isFinite(i)?i:p);var t=n(i);a?(t.forEach(r),u()):e()}if(a||!(Object.keys(v).length>0)){var t=d[0];if(T&&(clearTimeout(T),T=null),m&&t){var i=t.time,o=i-w.now(),f=a?o/c:0;T=setTimeout(e,Math.round(f))}}}var a=!0,c=1,f=!0,l=null,m=!1,s=null,p=i.systemNow(),d=[],v={},T=null,b=0,w={};return w.config=function(e){if(e){if("deterministic"in e&&(f=e.deterministic?!0:!1),"paced"in e&&(a=e.paced?!0:!1),"time"in e){if(e.time instanceof Date)p=e.time.valueOf();else{var t=Number(e.time);if(isNaN(t))throw new TypeError("Invalid time "+JSON.stringify(e.time)+". Time must be a Date or number");p=t}l=e.time}if("rate"in e){var r=Number(e.rate);if(isNaN(r)||0>=r)throw new TypeError("Invalid rate "+JSON.stringify(e.rate)+". Rate must be a positive number");p=w.now(),s=i.systemNow(),c=r}}return u(),{paced:a,rate:c,deterministic:f,time:l}},w.now=function(){if(a){if(m){var e=i.systemNow()-s,t=e*c;return p+t}return p}return p},w["continue"]=function(){s=i.systemNow(),m=!0,u()},w.pause=function(){p=w.now(),s=null,m=!1,u()},w.getTime=function(){return new Date(w.now())},w.valueOf=w.getTime,w.toString=function(){return w.getTime().toString()},w.setTimeout=function(e,r){var n=b++,i=w.now()+r;if(isNaN(i))throw new TypeError("delay must be a number");return t({id:n,type:o.TIMEOUT,time:i,callback:e}),u(),n},w.setTrigger=function(e,r){var n=b++,i=Number(r);if(isNaN(i))throw new TypeError("time must be a Date or number");return t({id:n,type:o.TRIGGER,time:i,callback:e}),u(),n},w.setInterval=function(e,r,n){var i=b++,a=Number(r);if(isNaN(a))throw new TypeError("interval must be a number");(0>a||!isFinite(a))&&(a=0);var c;if(void 0!=n){if(c=Number(n),isNaN(c))throw new TypeError("firstTime must be a Date or number")}else c=w.now()+a;return t({id:i,type:o.INTERVAL,interval:a,time:c,firstTime:c,occurrence:0,callback:e}),u(),i},w.clearTimeout=function(e){if(v[e])return void delete v[e];for(var t=0;t<d.length;t++)if(d[t].id===e){d.splice(t,1),u();break}},w.clearTrigger=w.clearTimeout,w.clearInterval=w.clearTimeout,w.list=function(){return d.map(function(e){return e.id})},w.clear=function(){v={},d=[],u()},Object.defineProperty(w,"running",{get:function(){return m}}),w.config(e),w["continue"](),w}var i=r(2),o={TIMEOUT:0,INTERVAL:1,TRIGGER:2};e.exports=n},function(e,t){t.systemNow="function"==typeof Date.now?function(){return Date.now()}:function(){return(new Date).valueOf()},t.shuffle=function(e){for(var t,r,n=e.length;n;t=Math.floor(Math.random()*n),r=e[--n],e[n]=e[t],e[t]=r);return e}}])});
!function(n,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("ws"),require("debug")):"function"==typeof define&&define.amd?define(["ws","debug"],t):"object"==typeof exports?exports.hypertimer=t(require("ws"),require("debug")):n.hypertimer=t(n.ws,n.debug)}(this,function(n,t){return function(n){function t(r){if(e[r])return e[r].exports;var o=e[r]={exports:{},id:r,loaded:!1};return n[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var e={};return t.m=n,t.c=e,t.p="",t(0)}([function(n,t,e){n.exports=e(1)},function(n,t,e){function r(n){function t(){return{paced:w,rate:y,deterministic:g,time:b,master:_}}function e(n){if(x||n.master)for(var t in n)if("master"!==t&&"slave"!==t)throw new Error('Cannot apply configuration option "'+t+'", timer is configured as slave.')}function r(n){function e(n){var e=t();r(n);var o=t();S.emit("config",o,e)}if("deterministic"in n&&(g=n.deterministic?!0:!1),"paced"in n&&(w=n.paced?!0:!1),"time"in n&&(j=h(n.time),O=f.systemNow(),s(j),b=new Date(j).toISOString()),"rate"in n){var o=Number(n.rate);if(isNaN(o)||0>=o)throw new TypeError("Invalid rate "+JSON.stringify(n.rate)+". Rate must be a positive number");j=S.now(),O=f.systemNow(),y=o}"master"in n&&(x&&(x.destroy(),x=null),n.master&&(x=c(n.master),x.on("change",function(n){e({time:n})}),x.on("config",function(n){e(n)}),x.on("error",function(n){S.emit("error",n)}))),"port"in n&&(_&&(_.destroy(),_=null),n.port&&(_=u(S.now,S.config,n.port),_.on("error",function(n){S.emit("error",n)}))),m(),_&&_.broadcastConfig()}function s(n){for(var t=0;t<E.length;t++){var e=E[t];e.type===a.INTERVAL&&l(e,n)}}function l(n,t){n.occurrence=Math.round((t-n.firstTime)/n.interval),n.time=n.firstTime+n.occurrence*n.interval}function d(n){if(E.length>0){for(var t=E.length-1;t>=0&&E[t].time>n.time;)t--;E.splice(t+1,0,n)}else E.push(n)}function p(n,t){function e(){n.type===a.INTERVAL&&I[n.id]&&(n.occurrence++,n.time=n.firstTime+n.occurrence*n.interval,d(n)),delete I[n.id],t&&t()}I[n.id]=n;try{0==n.callback.length?(n.callback(),e()):n.callback(e)}catch(r){i(S,"error")?S.emit("error",r):console.log("Error",r),e()}}function v(n){for(var t=0;t<E.length&&(E[t].time<=n||!isFinite(E[t].time));)t++;var e=E.splice(0,t);return 0==g&&f.shuffle(e),e}function m(){function n(){function n(){var e=t.shift();e?p(e,n):m()}w||(j=e>j&&isFinite(e)?e:j);var t=v(e);w?(t.forEach(p),m()):n()}if(w||!(Object.keys(I).length>0)){var t=E[0];if(k&&(clearTimeout(k),k=null),T&&t){var e=t.time,r=e-S.now(),o=w?r/y:0;k=setTimeout(n,Math.round(o))}}}function h(n){var t="number"==typeof n?n:n instanceof Date?n.valueOf():new Date(n).valueOf();if(isNaN(t))throw new TypeError("Invalid date "+JSON.stringify(n)+". Date, number, or ISOString expected");return t}var w=!0,y=1,g=!0,b=null,_=null,x=null,T=!1,O=null,j=f.systemNow(),E=[],I={},k=null,N=0,S=o({});return S.config=function(n){return n&&(e(n),r(n)),t()},S.now=function(){if(w){if(T){var n=f.systemNow()-O,t=n*y;return j+t}return j}return j},S["continue"]=function(){O=f.systemNow(),T=!0,m()},S.pause=function(){j=S.now(),O=null,T=!1,m()},S.getTime=function(){return new Date(S.now())},S.valueOf=S.getTime,S.toString=function(){return S.getTime().toString()},S.setTimeout=function(n,t){var e=N++,r=S.now()+t;if(isNaN(r))throw new TypeError("delay must be a number");return d({id:e,type:a.TIMEOUT,time:r,callback:n}),m(),e},S.setTrigger=function(n,t){var e=N++,r=h(t);return d({id:e,type:a.TRIGGER,time:r,callback:n}),m(),e},S.setInterval=function(n,t,e){var r=N++,o=Number(t);if(isNaN(o))throw new TypeError("interval must be a number");(0>o||!isFinite(o))&&(o=0);var i=void 0!=e?h(e):null,u=S.now(),c=null!=i?i:u+o,f={id:r,type:a.INTERVAL,interval:o,time:c,firstTime:null!=i?i:c,occurrence:0,callback:n};return u>c&&l(f,u),d(f),m(),r},S.clearTimeout=function(n){if(I[n])return void delete I[n];for(var t=0;t<E.length;t++)if(E[t].id===n){E.splice(t,1),m();break}},S.clearTrigger=S.clearTimeout,S.clearInterval=S.clearTimeout,S.list=function(){return E.map(function(n){return n.id})},S.clear=function(){I={},E=[],m()},S.destroy=function(){S.clear(),x&&x.destroy(),_&&_.destroy()},Object.defineProperty(S,"running",{get:function(){return T}}),S.config(n),S["continue"](),S}var o=e(5),i=e(6),u=e(2).createMaster,c=e(3).createSlave,f=e(4),a={TIMEOUT:0,INTERVAL:1,TRIGGER:2};n.exports=r},function(n,t,e){var r=e(7),o=e(8),i=e(9)("hypertimer:master");t.createMaster=function(n,t,e){function u(){var n=t();return delete n.time,delete n.master,n}var c=new r.Server({port:e});return c.on("connection",function(t){i("new connection");var e=o(t);e.on("time",function(t,e){var r=n();e(r),i("send time "+new Date(r).toISOString())});var r=u();i("send config",r),e.send("config",r),t.emitter=e}),c.broadcast=function(n,t){i("broadcast",n,t),c.clients.forEach(function(e){e.emitter.send(n,t)})},c.broadcastConfig=function(){c.broadcast("config",u())},c.destroy=function(){c.close(),i("destroyed")},i("listening at ws://localhost:"+e),c}},function(n,t,e){var r=e(7),o=e(10),i=e(9)("hypertimer:slave"),u=e(8),c=e(11),f=e(12),a=36e5,s=1e3,l=5;t.createSlave=function(n){function t(){function n(){var n=null;return m?o.resolve(n):e(p).then(function(t){n=t})["catch"](function(n){console.log(n)}).then(function(){return f.wait(s)}).then(function(){return n})}return f.repeat(n,l).then(function(n){var t=n.filter(function(n){return null!==n}),e=c.median(t)+c.std(t),r=t.filter(function(n){return e>n});return r.length>0?c.mean(r):null}).then(function(n){return m?o.resolve(null):p.request("time").then(function(t){var e=t+n;return p.emit("change",e),e})})["catch"](function(n){p.emit("error",n)})}function e(n){var t=Date.now();return n.request("time").then(function(e){var r=Date.now(),o=(r-t)/2,i=e+o;return v&&(v=!1,n.emit("change",i)),o})}var d=new r(n),p=u(d),v=!0,m=!1,h=null;return d.onopen=function(){i("connected"),t(),h=setInterval(t,a)},p.destroy=function(){m=!0,clearInterval(h),h=null,d.close(),i("destroyed")},p}},function(n,t){t.systemNow="function"==typeof Date.now?function(){return Date.now()}:function(){return(new Date).valueOf()},t.shuffle=function(n){for(var t,e,r=n.length;r;t=Math.floor(Math.random()*r),e=n[--r],n[r]=n[t],n[t]=e);return n}},function(n,t,e){"use strict";var r,o,i,u,c,f,a,s=e(15),l=e(19),d=Function.prototype.apply,p=Function.prototype.call,v=Object.create,m=Object.defineProperty,h=Object.defineProperties,w=Object.prototype.hasOwnProperty,y={configurable:!0,enumerable:!1,writable:!0};r=function(n,t){var e;return l(t),w.call(this,"__ee__")?e=this.__ee__:(e=y.value=v(null),m(this,"__ee__",y),y.value=null),e[n]?"object"==typeof e[n]?e[n].push(t):e[n]=[e[n],t]:e[n]=t,this},o=function(n,t){var e,o;return l(t),o=this,r.call(this,n,e=function(){i.call(o,n,e),d.call(t,this,arguments)}),e.__eeOnceListener__=t,this},i=function(n,t){var e,r,o,i;if(l(t),!w.call(this,"__ee__"))return this;if(e=this.__ee__,!e[n])return this;if(r=e[n],"object"==typeof r)for(i=0;o=r[i];++i)(o===t||o.__eeOnceListener__===t)&&(2===r.length?e[n]=r[i?0:1]:r.splice(i,1));else(r===t||r.__eeOnceListener__===t)&&delete e[n];return this},u=function(n){var t,e,r,o,i;if(w.call(this,"__ee__")&&(o=this.__ee__[n]))if("object"==typeof o){for(e=arguments.length,i=new Array(e-1),t=1;e>t;++t)i[t-1]=arguments[t];for(o=o.slice(),t=0;r=o[t];++t)d.call(r,this,i)}else switch(arguments.length){case 1:p.call(o,this);break;case 2:p.call(o,this,arguments[1]);break;case 3:p.call(o,this,arguments[1],arguments[2]);break;default:for(e=arguments.length,i=new Array(e-1),t=1;e>t;++t)i[t-1]=arguments[t];d.call(o,this,i)}},c={on:r,once:o,off:i,emit:u},f={on:s(r),once:s(o),off:s(i),emit:s(u)},a=h({},f),n.exports=t=function(n){return null==n?v(a):h(Object(n),f)},t.methods=c},function(n,t,e){"use strict";var r=e(17),o=e(18),i=Object.prototype.hasOwnProperty;n.exports=function(n){var t;return o(n),t=arguments[1],arguments.length>1?i.call(n,"__ee__")&&Boolean(n.__ee__[t]):n.hasOwnProperty("__ee__")&&!r(n.__ee__)}},function(n,t,e){n.exports="undefined"==typeof window||"undefined"==typeof window.WebSocket?e(13):window.WebSocket},function(n,t,e){var r=e(5),o=e(10),i=e(9)("hypertimer:socket"),u=6e4;n.exports=function(n){function t(t,e){var r={event:t,data:e};i("send",r),n.send(JSON.stringify(r))}function e(t,e){return new o(function(r,o){var i=c(),f={event:t,id:i,data:e};a[i]={resolve:r,reject:o,timeout:setTimeout(function(){delete a[i],o(new Error("Timeout"))},u)},n.send(JSON.stringify(f))})}function c(){return s++}var f=r({socket:n,send:t,request:e});n.onmessage=function(t){var e=t.data,r=JSON.parse(e);i("receive",r);var o=a[r.id];o?(clearTimeout(o.timeout),delete a[r.id],o.resolve(r.data)):"id"in r?f.emit(r.event,r.data,function(t){var e={id:r.id,data:t};i("reply",e),n.open&&n.send(JSON.stringify(e))}):f.emit(r.event,r.data)};var a={},s=0;return f}},function(n,t,e){var r="undefined"!=typeof window?window.Debug:e(14);n.exports=r||function(){return function(){}}},function(n,t,e){n.exports="undefined"==typeof window||"undefined"==typeof window.Promise?e(16):window.Promise},function(n,t){t.compare=function(n,t){return n>t?1:t>n?-1:0},t.add=function(n,t){return n+t},t.sum=function(n){return n.reduce(t.add)},t.mean=function(n){return t.sum(n)/n.length},t.std=function(n){return Math.sqrt(t.variance(n))},t.variance=function(n){if(n.length<2)return 0;var e=t.mean(n);return n.map(function(n){return Math.pow(n-e,2)}).reduce(t.add)/(n.length-1)},t.median=function(n){if(n.length<2)return n[0];var e=n.slice().sort(t.compare);return e.length%2===0?(n[n.length/2-1]+n[n.length/2])/2:n[(n.length-1)/2]}},function(n,t,e){var r=e(10);t.wait=function(n){return new r(function(t){setTimeout(t,n)})},t.repeat=function(n,t){return new r(function(e){function r(){t>o?(o++,n().then(function(n){i.push(n),r()})):e(i)}var o=0,i=[];r()})},t.whilst=function(n,t){return new r(function(e){function r(){n()?t().then(function(){r()}):e()}r()})}},function(t){t.exports=n},function(n){n.exports=t},function(n,t,e){"use strict";var r,o=e(26),i=e(20),u=e(21),c=e(27);r=n.exports=function(n,t){var e,r,u,f,a;return arguments.length<2||"string"!=typeof n?(f=t,t=n,n=null):f=arguments[2],null==n?(e=u=!0,r=!1):(e=c.call(n,"c"),r=c.call(n,"e"),u=c.call(n,"w")),a={value:t,configurable:e,enumerable:r,writable:u},f?o(i(f),a):a},r.gs=function(n,t,e){var r,f,a,s;return"string"!=typeof n?(a=e,e=t,t=n,n=null):a=arguments[3],null==t?t=void 0:u(t)?null==e?e=void 0:u(e)||(a=e,e=void 0):(a=t,t=e=void 0),null==n?(r=!0,f=!1):(r=c.call(n,"c"),f=c.call(n,"e")),s={get:t,set:e,configurable:r,enumerable:f},a?o(i(a),s):s}},function(n,t,e){"use strict";n.exports=e(22),e(23),e(24),e(25)},function(n,t,e){"use strict";var r=e(18),o=Object.prototype.propertyIsEnumerable;n.exports=function(n){var t;r(n);for(t in n)if(o.call(n,t))return!1;return!0}},function(n){"use strict";n.exports=function(n){if(null==n)throw new TypeError("Cannot use null or undefined");return n}},function(n){"use strict";n.exports=function(n){if("function"!=typeof n)throw new TypeError(n+" is not a function");return n}},function(n){"use strict";var t=Array.prototype.forEach,e=Object.create,r=function(n,t){var e;for(e in n)t[e]=n[e]};n.exports=function(){var n=e(null);return t.call(arguments,function(t){null!=t&&r(Object(t),n)}),n}},function(n){"use strict";n.exports=function(n){return"function"==typeof n}},function(n,t,e){"use strict";function r(n){function t(n){return null===f?void s.push(n):void u(function(){var t=f?n.onFulfilled:n.onRejected;if(null===t)return void(f?n.resolve:n.reject)(a);var e;try{e=t(a)}catch(r){return void n.reject(r)}n.resolve(e)})}function e(n){try{if(n===l)throw new TypeError("A promise cannot be resolved with itself.");if(n&&("object"==typeof n||"function"==typeof n)){var t=n.then;if("function"==typeof t)return void i(t.bind(n),e,r)}f=!0,a=n,c()}catch(o){r(o)}}function r(n){f=!1,a=n,c()}function c(){for(var n=0,e=s.length;e>n;n++)t(s[n]);s=null}if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof n)throw new TypeError("not a function");var f=null,a=null,s=[],l=this;this.then=function(n,e){return new l.constructor(function(r,i){t(new o(n,e,r,i))})},i(n,e,r)}function o(n,t,e,r){this.onFulfilled="function"==typeof n?n:null,this.onRejected="function"==typeof t?t:null,this.resolve=e,this.reject=r}function i(n,t,e){var r=!1;try{n(function(n){r||(r=!0,t(n))},function(n){r||(r=!0,e(n))})}catch(o){if(r)return;r=!0,e(o)}}var u=e(32);n.exports=r},function(n,t,e){"use strict";var r=e(22),o=e(32);n.exports=r,r.prototype.done=function(){var n=arguments.length?this.then.apply(this,arguments):this;n.then(null,function(n){o(function(){throw n})})}},function(n,t,e){"use strict";function r(n){this.then=function(t){return"function"!=typeof t?this:new o(function(e,r){i(function(){try{e(t(n))}catch(o){r(o)}})})}}var o=e(22),i=e(32);n.exports=o,r.prototype=o.prototype;var u=new r(!0),c=new r(!1),f=new r(null),a=new r(void 0),s=new r(0),l=new r("");o.resolve=function(n){if(n instanceof o)return n;if(null===n)return f;if(void 0===n)return a;if(n===!0)return u;if(n===!1)return c;if(0===n)return s;if(""===n)return l;if("object"==typeof n||"function"==typeof n)try{var t=n.then;if("function"==typeof t)return new o(t.bind(n))}catch(e){return new o(function(n,t){t(e)})}return new r(n)},o.all=function(n){var t=Array.prototype.slice.call(n);return new o(function(n,e){function r(i,u){try{if(u&&("object"==typeof u||"function"==typeof u)){var c=u.then;if("function"==typeof c)return void c.call(u,function(n){r(i,n)},e)}t[i]=u,0===--o&&n(t)}catch(f){e(f)}}if(0===t.length)return n([]);for(var o=t.length,i=0;i<t.length;i++)r(i,t[i])})},o.reject=function(n){return new o(function(t,e){e(n)})},o.race=function(n){return new o(function(t,e){n.forEach(function(n){o.resolve(n).then(t,e)})})},o.prototype["catch"]=function(n){return this.then(null,n)}},function(n,t,e){"use strict";var r=e(22),o=e(32);n.exports=r,r.denodeify=function(n,t){return t=t||1/0,function(){var e=this,o=Array.prototype.slice.call(arguments);return new r(function(r,i){for(;o.length&&o.length>t;)o.pop();o.push(function(n,t){n?i(n):r(t)});var u=n.apply(e,o);!u||"object"!=typeof u&&"function"!=typeof u||"function"!=typeof u.then||r(u)})}},r.nodeify=function(n){return function(){var t=Array.prototype.slice.call(arguments),e="function"==typeof t[t.length-1]?t.pop():null,i=this;try{return n.apply(this,arguments).nodeify(e,i)}catch(u){if(null===e||"undefined"==typeof e)return new r(function(n,t){t(u)});o(function(){e.call(i,u)})}}},r.prototype.nodeify=function(n,t){return"function"!=typeof n?this:void this.then(function(e){o(function(){n.call(t,null,e)})},function(e){o(function(){n.call(t,e)})})}},function(n,t,e){"use strict";n.exports=e(28)()?Object.assign:e(29)},function(n,t,e){"use strict";n.exports=e(30)()?String.prototype.contains:e(31)},function(n){"use strict";n.exports=function(){var n,t=Object.assign;return"function"!=typeof t?!1:(n={foo:"raz"},t(n,{bar:"dwa"},{trzy:"trzy"}),n.foo+n.bar+n.trzy==="razdwatrzy")}},function(n,t,e){"use strict";var r=e(33),o=e(18),i=Math.max;n.exports=function(n,t){var e,u,c,f=i(arguments.length,2);for(n=Object(o(n)),c=function(r){try{n[r]=t[r]}catch(o){e||(e=o)}},u=1;f>u;++u)t=arguments[u],r(t).forEach(c);if(void 0!==e)throw e;return n}},function(n){"use strict";var t="razdwatrzy";n.exports=function(){return"function"!=typeof t.contains?!1:t.contains("dwa")===!0&&t.contains("foo")===!1}},function(n){"use strict";var t=String.prototype.indexOf;n.exports=function(n){return t.call(this,n,arguments[1])>-1}},function(n,t,e){(function(t,e){function r(){for(;i.next;){i=i.next;var n=i.task;i.task=void 0;var t=i.domain;t&&(i.domain=void 0,t.enter());try{n()}catch(e){if(a)throw t&&t.exit(),setTimeout(r,0),t&&t.enter(),e;setTimeout(function(){throw e},0)}t&&t.exit()}c=!1}function o(n){u=u.next={task:n,domain:a&&t.domain,next:null},c||(c=!0,f())}var i={task:void 0,next:null},u=i,c=!1,f=void 0,a=!1;if("undefined"!=typeof t&&t.nextTick)a=!0,f=function(){t.nextTick(r)};else if("function"==typeof e)f="undefined"!=typeof window?e.bind(window,r):function(){e(r)};else if("undefined"!=typeof MessageChannel){var s=new MessageChannel;s.port1.onmessage=r,f=function(){s.port2.postMessage(0)}}else f=function(){setTimeout(r,0)};n.exports=o}).call(t,e(36),e(37).setImmediate)},function(n,t,e){"use strict";n.exports=e(34)()?Object.keys:e(35)},function(n){"use strict";n.exports=function(){try{return Object.keys("primitive"),!0}catch(n){return!1}}},function(n){"use strict";var t=Object.keys;n.exports=function(n){return t(null==n?n:Object(n))}},function(n){function t(){}var e=n.exports={};e.nextTick=function(){var n="undefined"!=typeof window&&window.setImmediate,t="undefined"!=typeof window&&window.MutationObserver,e="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(n)return function(n){return window.setImmediate(n)};var r=[];if(t){var o=document.createElement("div"),i=new MutationObserver(function(){var n=r.slice();r.length=0,n.forEach(function(n){n()})});return i.observe(o,{attributes:!0}),function(n){r.length||o.setAttribute("yes","no"),r.push(n)}}return e?(window.addEventListener("message",function(n){var t=n.source;if((t===window||null===t)&&"process-tick"===n.data&&(n.stopPropagation(),r.length>0)){var e=r.shift();e()}},!0),function(n){r.push(n),window.postMessage("process-tick","*")}):function(n){setTimeout(n,0)}}(),e.title="browser",e.browser=!0,e.env={},e.argv=[],e.on=t,e.addListener=t,e.once=t,e.off=t,e.removeListener=t,e.removeAllListeners=t,e.emit=t,e.binding=function(){throw new Error("process.binding is not supported")},e.cwd=function(){return"/"},e.chdir=function(){throw new Error("process.chdir is not supported")}},function(n,t,e){(function(n,r){var o=e(38).nextTick,i=Array.prototype.slice,u={},c=0;"undefined"!=typeof setTimeout&&(t.setTimeout=function(){return setTimeout.apply(window,arguments)}),"undefined"!=typeof clearTimeout&&(t.clearTimeout=function(){clearTimeout.apply(window,arguments)}),"undefined"!=typeof setInterval&&(t.setInterval=function(){return setInterval.apply(window,arguments)}),"undefined"!=typeof clearInterval&&(t.clearInterval=function(){clearInterval.apply(window,arguments)}),t.enroll=function(n,t){n._timeoutID=setTimeout(n._onTimeout,t)},t.unenroll=function(n){clearTimeout(n._timeoutID)},t.active=function(){},t.setImmediate="function"==typeof n?n:function(n){var e=c++,r=arguments.length<2?!1:i.call(arguments,1);return u[e]=!0,o(function(){u[e]&&(r?n.apply(null,r):n.call(null),t.clearImmediate(e))}),e},t.clearImmediate="function"==typeof r?r:function(n){delete u[n]}}).call(t,e(37).setImmediate,e(37).clearImmediate)},function(n){function t(){if(!i){i=!0;for(var n,t=o.length;t;){n=o,o=[];for(var e=-1;++e<t;)n[e]();t=o.length}i=!1}}function e(){}var r=n.exports={},o=[],i=!1;r.nextTick=function(n){o.push(n),i||setTimeout(t,0)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.on=e,r.addListener=e,r.once=e,r.off=e,r.removeListener=e,r.removeAllListeners=e,r.emit=e,r.binding=function(){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}}])});
//# sourceMappingURL=hypertimer.map
# History
## 2015-02-27, version 2.1.0
- Added support for ISOString dates for configuration of time, for using
`setInterval`, and for `setTrigger`. The time returned from config is always
an ISOString.
- Implemented a method `destroy`.
- Implemented events `'config'` and `'error'`.
- Implemented experimental support for synchronization between multiple
hypertimers in a master/slave configuration.
- Fixed expanding all occurrences of intervals when changing the time
to a moment in the future.
- Fixed expanding all occurrences of intervals started in the past.
## 2015-02-19, version 2.0.1

@@ -5,0 +19,0 @@

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

var emitter = require('event-emitter');
var hasListeners = require('event-emitter/has-listeners');
var createMaster = require('./synchronization/master').createMaster;
var createSlave = require('./synchronization/slave').createSlave;
var util = require('./util');

@@ -31,3 +35,3 @@

* Only applicable when option paced=true.
* time: number | Date
* time: number | Date | String
* Set a simulation time. If not provided,

@@ -42,7 +46,9 @@ * The timer is instantiated with the

var deterministic = true; // run simultaneous events in a deterministic order
var configuredTime = null;
var configuredTime = null;// only used for returning the configured time on .config()
var master = null;
var slave = null;
// properties
var running = false; // true when running
var realTime = null; // timestamp. the moment in real-time when hyperTime was set
var startTime = null; // timestamp. the moment in real-time when hyperTime was set
var hyperTime = util.systemNow(); // timestamp. the start time in hyper-time

@@ -55,3 +61,4 @@ var timeouts = []; // array with all running timeouts

// exported timer object with public functions and variables
var timer = {};
// add event-emitter mixin
var timer = emitter({});

@@ -80,3 +87,3 @@ /**

* Only applicable when option paced=true.
* time: number | Date
* time: number | Date | String
* Set a simulation time.

@@ -87,47 +94,8 @@ * @return {Object} Returns the applied configuration

if (options) {
if ('deterministic' in options) {
deterministic = options.deterministic ? true : false;
}
if ('paced' in options) {
paced = options.paced ? true : false;
}
// important: apply time before rate
if ('time' in options) {
if (options.time instanceof Date) {
hyperTime = options.time.valueOf();
}
else {
var newTime = Number(options.time);
if (isNaN(newTime)) {
throw new TypeError('Invalid time ' + JSON.stringify(options.time) + '. Time must be a Date or number');
}
hyperTime = newTime;
}
configuredTime = options.time;
}
if ('rate' in options) {
var newRate = Number(options.rate);
if (isNaN(newRate) || newRate <= 0) {
throw new TypeError('Invalid rate ' + JSON.stringify(options.rate) + '. Rate must be a positive number');
}
hyperTime = timer.now();
realTime = util.systemNow();
rate = newRate;
}
_validateConfig(options);
_setConfig(options);
}
// reschedule running timeouts
_schedule();
// return a copy of the configuration options
return {
paced: paced,
rate: rate,
deterministic: deterministic,
time: configuredTime
};
return _getConfig();
};

@@ -144,3 +112,3 @@

// TODO: implement performance.now() / process.hrtime(time) for high precision calculation of time interval
var realInterval = util.systemNow() - realTime;
var realInterval = util.systemNow() - startTime;
var hyperInterval = realInterval * rate;

@@ -162,3 +130,3 @@ return hyperTime + hyperInterval;

timer['continue'] = function() {
realTime = util.systemNow();
startTime = util.systemNow();
running = true;

@@ -175,3 +143,3 @@

hyperTime = timer.now();
realTime = null;
startTime = null;
running = false;

@@ -241,3 +209,4 @@

* @param {Function} callback Function executed when timeout occurs.
* @param {Date | number} time An absolute moment in time (Date) when the
* @param {Date | number | string } time
* An absolute moment in time (Date) when the
* callback will be triggered. When the date is

@@ -251,6 +220,3 @@ * a Date in the past, the callback is triggered

var id = idSeq++;
var timestamp = Number(time);
if (isNaN(timestamp)) {
throw new TypeError('time must be a Date or number');
}
var timestamp = toTimestamp(time);

@@ -281,3 +247,4 @@ // add a new timeout to the queue

* with a maximum rate.
* @param {Date | number} [firstTime] An absolute moment in time (Date) when the
* @param {Date | number | string} [firstTime]
* An absolute moment in time (Date) when the
* callback will be triggered the first time.

@@ -299,25 +266,27 @@ * By default, firstTime = now() + interval.

var timestamp;
if (firstTime != undefined) {
timestamp = Number(firstTime);
if (isNaN(timestamp)) {
throw new TypeError('firstTime must be a Date or number');
}
}
else {
// firstTime is undefined or null
timestamp = (timer.now() + _interval);
}
var _firstTime = (firstTime != undefined) ?
toTimestamp(firstTime) :
null;
// add a new timeout to the queue
_queueTimeout({
var now = timer.now();
var _time = (_firstTime != null) ? _firstTime : (now + _interval);
var timeout = {
id: id,
type: TYPE.INTERVAL,
interval: _interval,
time: timestamp,
firstTime: timestamp,
time: _time,
firstTime: _firstTime != null ? _firstTime : _time,
occurrence: 0,
callback: callback
});
};
if (_time < now) {
// update schedule when in the past
_rescheduleInterval(timeout, now);
}
// add a new timeout to the queue
_queueTimeout(timeout);
// reschedule the timeouts

@@ -384,2 +353,153 @@ _schedule();

/**
* Destroy the timer. This will clear all timeouts, and close connections
* to a master or to slave timers.
*/
timer.destroy = function () {
timer.clear();
if (slave) slave.destroy();
if (master) master.destroy();
};
/**
* Get the current configuration
* @returns {{paced: boolean, rate: number, deterministic: boolean, time: *, master: *}}
* Returns a copy of the current configuration
* @private
*/
function _getConfig () {
return {
paced: paced,
rate: rate,
deterministic: deterministic,
time: configuredTime,
master: master
}
}
/**
* Validate configuration, depending on the current mode: slave or normal
* @param {Object} options
* @private
*/
function _validateConfig (options) {
// validate writable options
if (slave || options.master) {
// when we are a slave, we can't adjust the config, except for
// changing the master url or becoming a master itself (port configured)
for (var prop in options) {
if (prop !== 'master' && prop !== 'slave') {
throw new Error('Cannot apply configuration option "' + prop +'", timer is configured as slave.');
}
}
}
}
/**
* Change configuration
* @param {{paced: boolean, rate: number, deterministic: boolean, time: *, master: *}} options
* @private
*/
function _setConfig(options) {
if ('deterministic' in options) {
deterministic = options.deterministic ? true : false;
}
if ('paced' in options) {
paced = options.paced ? true : false;
}
// important: apply time before rate
if ('time' in options) {
hyperTime = toTimestamp(options.time);
startTime = util.systemNow();
// update intervals
_rescheduleIntervals(hyperTime);
configuredTime = new Date(hyperTime).toISOString();
}
if ('rate' in options) {
var newRate = Number(options.rate);
if (isNaN(newRate) || newRate <= 0) {
throw new TypeError('Invalid rate ' + JSON.stringify(options.rate) + '. Rate must be a positive number');
}
// important: first get the new hyperTime, then adjust the startTime
hyperTime = timer.now();
startTime = util.systemNow();
rate = newRate;
}
if ('master' in options) {
// create a timesync slave, connect to master via a websocket
if (slave) {
slave.destroy();
slave = null;
}
if (options.master) {
slave = createSlave(options.master);
function applyConfig(config) {
var prev = _getConfig();
_setConfig(config);
var curr = _getConfig();
timer.emit('config', curr, prev);
}
slave.on('change', function (time) { applyConfig({time: time}) });
slave.on('config', function (config) { applyConfig(config) });
slave.on('error', function (err) { timer.emit('error', err) });
}
}
// create a master
if ('port' in options) {
if (master) {
master.destroy();
master = null;
}
if (options.port) {
master = createMaster(timer.now, timer.config, options.port);
master.on('error', function (err) { timer.emit('error', err) });
}
}
// reschedule running timeouts
_schedule();
if (master) {
// broadcast changed config
master.broadcastConfig();
}
}
/**
* Reschedule all intervals after a new time has been set.
* @param {number} now
* @private
*/
function _rescheduleIntervals(now) {
for (var i = 0; i < timeouts.length; i++) {
var timeout = timeouts[i];
if (timeout.type === TYPE.INTERVAL) {
_rescheduleInterval(timeout, now);
}
}
}
/**
* Reschedule the intervals after a new time has been set.
* @param {Object} timeout
* @param {number} now
* @private
*/
function _rescheduleInterval(timeout, now) {
timeout.occurrence = Math.round((now - timeout.firstTime) / timeout.interval);
timeout.time = timeout.firstTime + timeout.occurrence * timeout.interval;
}
/**
* Add a timeout to the queue. After the queue has been changed, the queue

@@ -412,3 +532,3 @@ * must be rescheduled by executing _reschedule()

* @param {{id: number, type: number, time: number, callback: function}} timeout
* @param {function} [callback]
* @param {function} callback
* The callback is executed when the timeout's callback is

@@ -430,2 +550,3 @@ * finished. Called without parameters

_queueTimeout(timeout);
//console.log('queue timeout', timer.getTime().toISOString(), new Date(timeout.time).toISOString(), timeout.occurrence) // TODO: cleanup
}

@@ -450,3 +571,10 @@

} catch (err) {
// silently ignore errors thrown by the callback
// emit or log the error
if (hasListeners(timer, 'error')) {
timer.emit('error', err);
}
else {
console.log('Error', err);
}
finish();

@@ -549,2 +677,23 @@ }

/**
* Convert a Date, number, or ISOString to a number timestamp,
* and validate whether it's a valid Date. The number Infinity is also
* accepted as a valid timestamp
* @param {Date | number | string} date
* @return {number} Returns a unix timestamp, a number
*/
function toTimestamp(date) {
var value =
(typeof date === 'number') ? date : // number
(date instanceof Date) ? date.valueOf() : // Date
new Date(date).valueOf(); // ISOString, momentjs, ...
if (isNaN(value)) {
throw new TypeError('Invalid date ' + JSON.stringify(date) + '. ' +
'Date, number, or ISOString expected');
}
return value;
}
Object.defineProperty(timer, 'running', {

@@ -551,0 +700,0 @@ get: function () {

{
"name": "hypertimer",
"version": "2.0.1",
"version": "2.1.0",
"description": "Time control for simulations",

@@ -21,6 +21,14 @@ "author": "Jos de Jong <wjosdejong@gmail.com> (https://github.com/josdejong)",

},
"dependencies": {},
"dependencies": {
"body-parser": "^1.12.0",
"debug": "^2.1.1",
"event-emitter": "^0.3.3",
"node-uuid": "^1.4.2",
"promise": "^6.1.0",
"ws": "^0.7.1"
},
"devDependencies": {
"async": "^0.9.0",
"browserify": "^8.1.3",
"freeport": "^1.0.4",
"gulp": "^3.8.11",

@@ -27,0 +35,0 @@ "gulp-util": "^3.0.3",

@@ -102,8 +102,6 @@ hypertimer

// create a hypertimer with the initial time at 14st of February 2015
var timer = hypertimer({
time: new Date(2015, 1, 14, 12, 0, 0)
});
var timer = hypertimer({time: '2015-01-14T12:00:00.000Z'});
// change the time to the 1st of January 2050
timer.config({time: new Date(2050, 0, 1, 12, 0, 0)});
timer.config({time: '2050-01-01T12:00:00.000Z'});

@@ -254,3 +252,39 @@ // get the time as Date

### Synchronization
Hypertimers running on multiple machines can be synchronized in a master/slave configuration. Multiple slaves can connect to a master via a WebSocket. The slaves will synchronize their time and configuration with that of the master.
WARNING: this is an experimental feature, and currently only supportes *paced* mode.
To create a master hypertimer, specify a port in the configuration. The hypertimer will open a websocket on this port.
```js
// create a master hypertimer listening on port 8081
var masterTimer = hypertimer({port: 8081});
```
To connect to a master hypertimer, specify the url of the master in the property `master`. The created timer will than act as a slave and synchronize retrieves configuration and time from the master.
```js
// create a slave hypertimer connected to the master on port 8081
var slaveTimer = hypertimer({master: 'ws://localhost:8081'});
```
Use the `destroy()` method to neatly shutdown master and slave timers:
```
// close all connections, clear all timeouts
masterTimer.destroy();
slaveTimer.destroy();
```
## Examples
Examples can be found here:
https://github.com/enmasseio/hypertimer/tree/master/examples
## API

@@ -273,5 +307,7 @@

deterministic | boolean | `true` | If true, (default) events taking place at the same time are executed in a deterministic order: in the same order they where created. If false, they are executed in a randomized order.
master | string | null | The url of a master hypertimer, for example `"ws://localhost:8081"`. If configured, the hypertimer will run as a slave, and synchronize it's configuration and time with its masters configuration and time.
paced | boolean | `true` | Mode for pacing of time. When paced, the time proceeds at a continuous, configurable rate, useful for animation purposes. When unpaced, the time jumps immediately from scheduled event to the next scheduled event.
port | number | null | If provided, the hypertimer will open a websocket on the given port. The hypertimer will than act as a master. Multiple hypertimer slaves can connect to a master.
rate | number | 1 | The rate of progress of time with respect to real-time. Rate must be a positive number. For example when 2, the time of the hypertimer runs twice as fast as real-time. Only applicable when option paced is true.
time | number or Date | `null` | Sets the simulation time. If not configured, a hypertimer is instantiated with the system time.
time | number, Date, or ISO string | `null` | Sets the simulation time. If not configured, a hypertimer is instantiated with the system time.

@@ -324,3 +360,3 @@ Example:

- `time: number | Date`
- `time: number | Date | String`

@@ -334,2 +370,6 @@ Set a simulation time.

- **`destroy()`**
Destroy the hypertimer. Clears all timeouts, and closes any connection to master and slave hypertimers.
- **`getTime(): Date`**

@@ -352,3 +392,3 @@

- **`setInterval(callback: Function, interval: number [, firstTime: Date | number])`**
- **`setInterval(callback: Function, interval: number [, firstTime: Date | number | ISOString])`**

@@ -382,3 +422,3 @@ Trigger a callback every interval. Optionally, a start date can be provided

- **`setTrigger(callback: Function, time: Date | number) : number`**
- **`setTrigger(callback: Function, time: Date | number | ISOString ) : number`**

@@ -404,9 +444,51 @@ Set a trigger, which is triggered when the timeout occurs in hyper-time. See also `getTimeout`. The function returns a triggerId which can be used to cancel the trigger using `clearTrigger()`. The parameters are:

## Examples
### Events
Examples can be found here:
https://github.com/enmasseio/hypertimer/tree/master/examples
Available options:
Event | Description
--------- | -----------
config | Triggered when the configuration is changed by the master timer. Called with the new configuration as first argument, and the previous configuration as second argument.
error | Triggered when an error occurred, for example when one of the timout callbacks throws an Error.
Methods:
- **`emit(event: string, ...args: *)`**
Emit an event.
- **`on(event: string, callback: function)`**
Register a listener for an event
- **`once(event: string, callback: function)`**
Register a listener for an event, which will be invoked only once and is removed after that.
- **`off(event: string, callback: function)`**
Unregister a listener for an event
Example:
```js
var timer = hypertimer();
timer.on('config', function (curr, prev)) {
console.log('config changed. old config:', prev, ', new config:', curr);
});
timer.on('error', function (err)) {
console.log('Error:', err);
});
```
### Protocol
TODO: describe the protocol used to communicate between master and slaves.
## Roadmap

@@ -413,0 +495,0 @@

@@ -6,4 +6,6 @@ // NOTE: all timeouts should have time differences of at least 50ms to be

var seed = require('seed-random');
var hypertimer = require('../lib/hypertimer');
var hypertimer = require('../index');
// TODO: split hypertimer.test.js in separate files, it has grown too large
/**

@@ -18,3 +20,3 @@ * Assert whether two dates are approximately equal.

assert(Math.abs(date1 - date2) < (epsilon === undefined ? 25 : epsilon),
date1.toISOString() + ' ~= ' + date2.toISOString());
(date1 && date1.toISOString()) + ' ~= ' + (date2 && date2.toISOString()));
}

@@ -41,3 +43,6 @@

var timer = hypertimer();
assert.deepEqual(timer.config(), {paced: true, rate: 1, deterministic: true, time: null});
assert.deepEqual(timer.config(), {paced: true, rate: 1, deterministic: true, time: null, master: null});
var timer2 = hypertimer({paced: false, rate: 2, deterministic: false, time: 2524651200000});
assert.deepEqual(timer2.config(), {paced: false, rate: 2, deterministic: false, time: '2050-01-01T12:00:00.000Z', master: null});
});

@@ -99,6 +104,15 @@

it ('should set the current hyper-time from an ISO string', function () {
var time = '2050-01-01T12:00:00.000Z';
var timer = hypertimer({
rate: 1,
time: time
});
approx(timer.getTime(), new Date(time));
});
it ('should throw an error in case of invalid variable', function () {
var timer = hypertimer({rate: 1});
assert.throws(function () {timer.config({time:'bla'})}, /Invalid time "bla". Time must be a Date or number/);
assert.throws(function () {timer.config({time:{}})}, /Invalid time \{}. Time must be a Date or number/);
assert.throws(function () {timer.config({time:'bla'})}, /Invalid date "bla". Date, number, or ISOString expected/);
assert.throws(function () {timer.config({time:{}})}, /Invalid date \{}. Date, number, or ISOString expected/);
});

@@ -681,2 +695,50 @@

it('should adjust an interval when the timers time is adjusted into the future', function (done) {
var logs = [];
var timer = hypertimer({time: '2050-01-01T12:00:00.000Z'});
timer.setInterval(function () {
logs.push(timer.getTime())
}, 100);
// jump ~10 sec in the future
setTimeout(function () {
timer.config({time: '2050-01-01T12:00:10.050Z'});
}, 250);
setTimeout(function () {
approx(logs[0], new Date('2050-01-01T12:00:00.100Z'));
approx(logs[1], new Date('2050-01-01T12:00:00.200Z'));
approx(logs[2], new Date('2050-01-01T12:00:10.100Z'));
assert.equal(logs.length, 3);
done();
}, 350);
});
it('should adjust an interval when the timers time is adjusted into the past', function (done) {
var logs = [];
var timer = hypertimer({time: '2050-01-01T12:00:00.000Z'});
timer.setInterval(function () {
logs.push(timer.getTime())
}, 100);
// jump ~10 sec in the past
setTimeout(function () {
timer.config({time: '2050-01-01T11:00:50.050Z'});
}, 250);
setTimeout(function () {
approx(logs[0], new Date('2050-01-01T12:00:00.100Z'));
approx(logs[1], new Date('2050-01-01T12:00:00.200Z'));
approx(logs[2], new Date('2050-01-01T11:00:50.100Z'));
assert.equal(logs.length, 3);
done();
}, 350);
});
it('should set an interval with firstTime', function (done) {

@@ -721,5 +783,30 @@ var timer = hypertimer({

}
}, 100, firstTime.valueOf());
}, 100, firstTime);
});
it('should set an interval with a firstTime in the past', function (done) {
var timer = hypertimer({time: '2050-01-01T12:00:00Z'});
var occurrence = 0;
var interval = timer.setInterval(function () {
try {
occurrence++;
if (occurrence == 1) approx(timer.getTime(), new Date('2050-01-01T12:00:00.000Z'));
if (occurrence == 2) approx(timer.getTime(), new Date('2050-01-01T12:00:00.100Z'));
if (occurrence == 3) approx(timer.getTime(), new Date('2050-01-01T12:00:00.200Z'));
if (occurrence == 3) {
timer.clearInterval(interval);
assert.deepEqual(timer.list(), []);
done();
}
}
catch (err) {
timer.clearInterval(interval);
done(err);
}
}, 100, '2015-01-01');
});
it('should clear an interval using clearInterval', function (done) {

@@ -1227,3 +1314,3 @@ var timer = hypertimer({rate: 1});

it('should execute timeouts in non-deterministic order', function () {
it('should execute timeouts in non-deterministic order', function (done) {
var timer = hypertimer({paced: false, deterministic: false});

@@ -1329,2 +1416,22 @@

describe('events', function () {
// note: the `config` event is tested for in synchronization.test.js
it('should emit an error event', function (done) {
var timer = hypertimer();
timer.on('error', function (err) {
assert.equal(err.toString(), 'ReferenceError: a is not defined');
done();
});
timer.setTimeout(function() {
a + 2; // will throw an ReferenceError : a is not defined
}, 0);
});
});
// TODO: should test master/slave
});

Sorry, the diff of this file is too big to display

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