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

@reatom/timer

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@reatom/timer - npm Package Compare versions

Comparing version 3.4.2 to 3.5.1

11

build/index.d.ts

@@ -1,7 +0,8 @@

import { Action, AtomMut } from '@reatom/core';
import { Action, Atom, AtomMut } from '@reatom/core';
export interface TimerAtom extends AtomMut<number> {
/** (delay - remains) / delay */
progressAtom: AtomMut<number>;
progressAtom: Atom<number>;
/** interval in ms */
intervalAtom: AtomMut<number> & {
/** @deprecated extra thing */
setSeconds: Action<[seconds: number], number>;

@@ -11,6 +12,8 @@ };

startTimer: Action<[delay: number], Promise<void>>;
/** stop timer manually */
stopTimer: Action<[], void>;
/** allow to pause timer */
pauseAtom: AtomMut<boolean>;
/** stop timer manually */
stopTimer: Action<[], void>;
/** switch pause state */
pause: Action<[], boolean>;
/** track end of timer. Do not call manually! */

@@ -17,0 +20,0 @@ endTimer: Action<[], void>;

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

var t=require("@reatom/core"),e=require("@reatom/primitives"),n=require("@reatom/hooks");const o=()=>{};function r(t,e,n){if(!t.s){if(n instanceof i){if(!n.s)return void(n.o=r.bind(null,t,e));1&e&&(e=n.s),n=n.v}if(n&&n.then)return void n.then(r.bind(null,t,e),r.bind(null,t,2));t.s=e,t.v=n;const o=t.o;o&&o(t)}}const i=/*#__PURE__*/function(){function t(){}return t.prototype.then=function(e,n){const o=new t,i=this.s;if(i){const t=1&i?e:n;if(t){try{r(o,1,t(this.v))}catch(t){r(o,2,t)}return o}return this}return this.o=function(t){try{const i=t.v;1&t.s?r(o,1,e?e(i):i):n?r(o,1,n(i)):r(o,2,i)}catch(t){r(o,2,t)}},o},t}();function s(t){return t instanceof i&&1&t.s}exports.reatomTimer=(u={})=>{const{name:c=t.__count("timerAtom"),interval:a=1e3,delayMultiplier:h=1e3,progressPrecision:m=2,resetProgress:f=!0}="string"==typeof u?{name:u}:u,v=Math.pow(10,m),l=t.atom(0,`${c}Atom`),d=t.atom(0,`${c}.progressAtom`),p=t.atom(!1,`${c}.pauseAtom`),w=t.atom(a,`${c}.intervalAtom`).pipe(e.withReducers({setSeconds:(t,e)=>1e3*e})),g=t.atom(0,`${c}._versionAtom`),A=t.action((t,e)=>{e*=h;const u=g(t,t=>t+1),c=Date.now();let a=e+c,m=e,f=Promise.resolve(),A=o;l(t,m),d(t,0),p(t,!1);const P=n.onUpdate(p,(t,e)=>t.schedule(()=>{if(e){const t=Date.now();f=new Promise(e=>{A=()=>{a+=Date.now()-t,e()}})}else A()}));return t.schedule(function(){try{let o;function n(e){if(o)return e;b(t)}const c=function(t,e,n){for(var o;;){var u=t();if(s(u)&&(u=u.v),!u)return c;if(u.then){o=0;break}var c=n();if(c&&c.then){if(!s(c)){o=1;break}c=c.s}}var a=new i,h=r.bind(null,a,2);return(0===o?u.then(f):1===o?c.then(m):(void 0).then(function(){(u=t())?u.then?u.then(f).then(void 0,h):f(u):r(a,1,c)})).then(void 0,h),a;function m(e){c=e;do{if(!(u=t())||s(u)&&!u.v)return void r(a,1,c);if(u.then)return void u.then(f).then(void 0,h);s(c=n())&&(c=c.v)}while(!c||!c.then);c.then(m).then(void 0,h)}function f(t){t?(c=n())&&c.then?c.then(m).then(void 0,h):m(c):r(a,1,c)}}(function(){return!o&&m>0},0,function(){return Promise.resolve(((t=0)=>new Promise(e=>setTimeout(e,t)))(Math.min(m,t.get(w)))).then(function(){return Promise.resolve(f).then(function(){u===t.get(g)?t.get.bind(t)(()=>{const n=t.get(w);m=l(t,a-Date.now());const o=(e-m)/e;d(t,Math.round((o-o%(n/e))*v)/v)}):o=1})})});return Promise.resolve(c&&c.then?c.then(n):n(c))}catch(h){return Promise.reject(h)}}).finally(P)},`${c}.startTimer`),P=t.action(t=>{g(t,t=>t+1),b(t),f&&d(t,0)},`${c}.stopTimer`),b=t.action(t=>{l(t,0)},`${c}.endTimer`);return Object.assign(l,{progressAtom:d,endTimer:b,intervalAtom:w,startTimer:A,stopTimer:P,pauseAtom:p})};
var t=require("@reatom/core"),e=require("@reatom/primitives"),n=require("@reatom/hooks");const o=()=>{};function r(t,e,n){if(!t.s){if(n instanceof i){if(!n.s)return void(n.o=r.bind(null,t,e));1&e&&(e=n.s),n=n.v}if(n&&n.then)return void n.then(r.bind(null,t,e),r.bind(null,t,2));t.s=e,t.v=n;const o=t.o;o&&o(t)}}const i=/*#__PURE__*/function(){function t(){}return t.prototype.then=function(e,n){const o=new t,i=this.s;if(i){const t=1&i?e:n;if(t){try{r(o,1,t(this.v))}catch(t){r(o,2,t)}return o}return this}return this.o=function(t){try{const i=t.v;1&t.s?r(o,1,e?e(i):i):n?r(o,1,n(i)):r(o,2,i)}catch(t){r(o,2,t)}},o},t}();function s(t){return t instanceof i&&1&t.s}exports.reatomTimer=(u={})=>{const{name:c=t.__count("timerAtom"),interval:a=1e3,delayMultiplier:h=1e3,progressPrecision:m=2,resetProgress:f=!0}="string"==typeof u?{name:u}:u,v=Math.pow(10,m),l=t.atom(0,`${c}Atom`),d=t.atom(0,`${c}.progressAtom`),p=t.atom(!1,`${c}.pauseAtom`),w=t.atom(a,`${c}.intervalAtom`).pipe(e.withReducers({setSeconds:(t,e)=>1e3*e})),g=t.atom(0,`${c}._versionAtom`),A=t.action((t,e)=>{e*=h;const u=g(t,t=>t+1),c=Date.now();let a=e+c,m=e,f=Promise.resolve(),A=o;l(t,m),d(t,0),p(t,!1);const P=n.onUpdate(p,(t,e)=>t.schedule(()=>{if(e){const t=Date.now();f=new Promise(e=>{A=()=>{a+=Date.now()-t,e()}})}else A()}));return t.schedule(function(){try{let o;function n(e){if(o)return e;$(t)}const c=function(t,e,n){for(var o;;){var u=t();if(s(u)&&(u=u.v),!u)return c;if(u.then){o=0;break}var c=n();if(c&&c.then){if(!s(c)){o=1;break}c=c.s}}var a=new i,h=r.bind(null,a,2);return(0===o?u.then(f):1===o?c.then(m):(void 0).then(function(){(u=t())?u.then?u.then(f).then(void 0,h):f(u):r(a,1,c)})).then(void 0,h),a;function m(e){c=e;do{if(!(u=t())||s(u)&&!u.v)return void r(a,1,c);if(u.then)return void u.then(f).then(void 0,h);s(c=n())&&(c=c.v)}while(!c||!c.then);c.then(m).then(void 0,h)}function f(t){t?(c=n())&&c.then?c.then(m).then(void 0,h):m(c):r(a,1,c)}}(function(){return!o&&m>0},0,function(){return Promise.resolve(((t=0)=>new Promise(e=>setTimeout(e,t)))(Math.min(m,t.get(w)))).then(function(){return Promise.resolve(f).then(function(){u===t.get(g)?t.get.bind(t)(()=>{const n=t.get(w);m=l(t,a-Date.now());const o=(e-m)/e;d(t,Math.round((o-o%(n/e))*v)/v)}):o=1})})});return Promise.resolve(c&&c.then?c.then(n):n(c))}catch(h){return Promise.reject(h)}}).finally(P)},`${c}.startTimer`),P=t.action(t=>{g(t,t=>t+1),$(t),f&&d(t,0)},`${c}.stopTimer`),$=t.action(t=>{l(t,0)},`${c}.endTimer`),b=t.action(t=>p(t,t=>!t),`${c}.pause`);return Object.assign(l,{progressAtom:d,endTimer:$,intervalAtom:w,startTimer:A,stopTimer:P,pauseAtom:p,pause:b})};
//# sourceMappingURL=index.js.map

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

import{__count as t,atom as e,action as n}from"@reatom/core";import{withReducers as o}from"@reatom/primitives";import{onUpdate as r}from"@reatom/hooks";const i=()=>{};function s(t,e,n){if(!t.s){if(n instanceof u){if(!n.s)return void(n.o=s.bind(null,t,e));1&e&&(e=n.s),n=n.v}if(n&&n.then)return void n.then(s.bind(null,t,e),s.bind(null,t,2));t.s=e,t.v=n;const o=t.o;o&&o(t)}}const u=/*#__PURE__*/function(){function t(){}return t.prototype.then=function(e,n){const o=new t,r=this.s;if(r){const t=1&r?e:n;if(t){try{s(o,1,t(this.v))}catch(t){s(o,2,t)}return o}return this}return this.o=function(t){try{const r=t.v;1&t.s?s(o,1,e?e(r):r):n?s(o,1,n(r)):s(o,2,r)}catch(t){s(o,2,t)}},o},t}();function c(t){return t instanceof u&&1&t.s}const h=(h={})=>{const{name:f=t("timerAtom"),interval:m=1e3,delayMultiplier:a=1e3,progressPrecision:v=2,resetProgress:l=!0}="string"==typeof h?{name:h}:h,d=Math.pow(10,v),p=e(0,`${f}Atom`),g=e(0,`${f}.progressAtom`),w=e(!1,`${f}.pauseAtom`),A=e(m,`${f}.intervalAtom`).pipe(o({setSeconds:(t,e)=>1e3*e})),P=e(0,`${f}._versionAtom`),b=n((t,e)=>{e*=a;const n=P(t,t=>t+1),o=Date.now();let h=e+o,f=e,m=Promise.resolve(),v=i;p(t,f),g(t,0),w(t,!1);const l=r(w,(t,e)=>t.schedule(()=>{if(e){const t=Date.now();m=new Promise(e=>{v=()=>{h+=Date.now()-t,e()}})}else v()}));return t.schedule(function(){try{let r;function o(e){if(r)return e;y(t)}const i=function(t,e,n){for(var o;;){var r=t();if(c(r)&&(r=r.v),!r)return i;if(r.then){o=0;break}var i=n();if(i&&i.then){if(!c(i)){o=1;break}i=i.s}}var h=new u,f=s.bind(null,h,2);return(0===o?r.then(a):1===o?i.then(m):(void 0).then(function(){(r=t())?r.then?r.then(a).then(void 0,f):a(r):s(h,1,i)})).then(void 0,f),h;function m(e){i=e;do{if(!(r=t())||c(r)&&!r.v)return void s(h,1,i);if(r.then)return void r.then(a).then(void 0,f);c(i=n())&&(i=i.v)}while(!i||!i.then);i.then(m).then(void 0,f)}function a(t){t?(i=n())&&i.then?i.then(m).then(void 0,f):m(i):s(h,1,i)}}(function(){return!r&&f>0},0,function(){return Promise.resolve(((t=0)=>new Promise(e=>setTimeout(e,t)))(Math.min(f,t.get(A)))).then(function(){return Promise.resolve(m).then(function(){n===t.get(P)?t.get.bind(t)(()=>{const n=t.get(A);f=p(t,h-Date.now());const o=(e-f)/e;g(t,Math.round((o-o%(n/e))*d)/d)}):r=1})})});return Promise.resolve(i&&i.then?i.then(o):o(i))}catch(a){return Promise.reject(a)}}).finally(l)},`${f}.startTimer`),$=n(t=>{P(t,t=>t+1),y(t),l&&g(t,0)},`${f}.stopTimer`),y=n(t=>{p(t,0)},`${f}.endTimer`);return Object.assign(p,{progressAtom:g,endTimer:y,intervalAtom:A,startTimer:b,stopTimer:$,pauseAtom:w})};export{h as reatomTimer};
import{__count as t,atom as e,action as n}from"@reatom/core";import{withReducers as o}from"@reatom/primitives";import{onUpdate as r}from"@reatom/hooks";const i=()=>{};function s(t,e,n){if(!t.s){if(n instanceof u){if(!n.s)return void(n.o=s.bind(null,t,e));1&e&&(e=n.s),n=n.v}if(n&&n.then)return void n.then(s.bind(null,t,e),s.bind(null,t,2));t.s=e,t.v=n;const o=t.o;o&&o(t)}}const u=/*#__PURE__*/function(){function t(){}return t.prototype.then=function(e,n){const o=new t,r=this.s;if(r){const t=1&r?e:n;if(t){try{s(o,1,t(this.v))}catch(t){s(o,2,t)}return o}return this}return this.o=function(t){try{const r=t.v;1&t.s?s(o,1,e?e(r):r):n?s(o,1,n(r)):s(o,2,r)}catch(t){s(o,2,t)}},o},t}();function c(t){return t instanceof u&&1&t.s}const h=(h={})=>{const{name:f=t("timerAtom"),interval:m=1e3,delayMultiplier:a=1e3,progressPrecision:v=2,resetProgress:l=!0}="string"==typeof h?{name:h}:h,d=Math.pow(10,v),p=e(0,`${f}Atom`),g=e(0,`${f}.progressAtom`),w=e(!1,`${f}.pauseAtom`),A=e(m,`${f}.intervalAtom`).pipe(o({setSeconds:(t,e)=>1e3*e})),P=e(0,`${f}._versionAtom`),$=n((t,e)=>{e*=a;const n=P(t,t=>t+1),o=Date.now();let h=e+o,f=e,m=Promise.resolve(),v=i;p(t,f),g(t,0),w(t,!1);const l=r(w,(t,e)=>t.schedule(()=>{if(e){const t=Date.now();m=new Promise(e=>{v=()=>{h+=Date.now()-t,e()}})}else v()}));return t.schedule(function(){try{let r;function o(e){if(r)return e;y(t)}const i=function(t,e,n){for(var o;;){var r=t();if(c(r)&&(r=r.v),!r)return i;if(r.then){o=0;break}var i=n();if(i&&i.then){if(!c(i)){o=1;break}i=i.s}}var h=new u,f=s.bind(null,h,2);return(0===o?r.then(a):1===o?i.then(m):(void 0).then(function(){(r=t())?r.then?r.then(a).then(void 0,f):a(r):s(h,1,i)})).then(void 0,f),h;function m(e){i=e;do{if(!(r=t())||c(r)&&!r.v)return void s(h,1,i);if(r.then)return void r.then(a).then(void 0,f);c(i=n())&&(i=i.v)}while(!i||!i.then);i.then(m).then(void 0,f)}function a(t){t?(i=n())&&i.then?i.then(m).then(void 0,f):m(i):s(h,1,i)}}(function(){return!r&&f>0},0,function(){return Promise.resolve(((t=0)=>new Promise(e=>setTimeout(e,t)))(Math.min(f,t.get(A)))).then(function(){return Promise.resolve(m).then(function(){n===t.get(P)?t.get.bind(t)(()=>{const n=t.get(A);f=p(t,h-Date.now());const o=(e-f)/e;g(t,Math.round((o-o%(n/e))*d)/d)}):r=1})})});return Promise.resolve(i&&i.then?i.then(o):o(i))}catch(a){return Promise.reject(a)}}).finally(l)},`${f}.startTimer`),b=n(t=>{P(t,t=>t+1),y(t),l&&g(t,0)},`${f}.stopTimer`),y=n(t=>{p(t,0)},`${f}.endTimer`),T=n(t=>w(t,t=>!t),`${f}.pause`);return Object.assign(p,{progressAtom:g,endTimer:y,intervalAtom:A,startTimer:$,stopTimer:b,pauseAtom:w,pause:T})};export{h as reatomTimer};
//# sourceMappingURL=index.module.js.map

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@reatom/core"),require("@reatom/primitives"),require("@reatom/hooks")):"function"==typeof define&&define.amd?define(["exports","@reatom/core","@reatom/primitives","@reatom/hooks"],t):t((e||self).timer={},e.core,e.primitives,e.hooks)}(this,function(e,t,n,o){const r=()=>{};function i(e,t,n){if(!e.s){if(n instanceof s){if(!n.s)return void(n.o=i.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(i.bind(null,e,t),i.bind(null,e,2));e.s=t,e.v=n;const o=e.o;o&&o(e)}}const s=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){const o=new e,r=this.s;if(r){const e=1&r?t:n;if(e){try{i(o,1,e(this.v))}catch(e){i(o,2,e)}return o}return this}return this.o=function(e){try{const r=e.v;1&e.s?i(o,1,t?t(r):r):n?i(o,1,n(r)):i(o,2,r)}catch(e){i(o,2,e)}},o},e}();function u(e){return e instanceof s&&1&e.s}e.reatomTimer=(e={})=>{const{name:c=t.__count("timerAtom"),interval:a=1e3,delayMultiplier:f=1e3,progressPrecision:m=2,resetProgress:h=!0}="string"==typeof e?{name:e}:e,d=Math.pow(10,m),l=t.atom(0,`${c}Atom`),v=t.atom(0,`${c}.progressAtom`),p=t.atom(!1,`${c}.pauseAtom`),g=t.atom(a,`${c}.intervalAtom`).pipe(n.withReducers({setSeconds:(e,t)=>1e3*t})),b=t.atom(0,`${c}._versionAtom`),w=t.action((e,t)=>{t*=f;const n=b(e,e=>e+1),c=Date.now();let a=t+c,m=t,h=Promise.resolve(),w=r;l(e,m),v(e,0),p(e,!1);const y=o.onUpdate(p,(e,t)=>e.schedule(()=>{if(t){const e=Date.now();h=new Promise(t=>{w=()=>{a+=Date.now()-e,t()}})}else w()}));return e.schedule(function(){try{let r;function o(t){if(r)return t;T(e)}const c=function(e,t,n){for(var o;;){var r=e();if(u(r)&&(r=r.v),!r)return c;if(r.then){o=0;break}var c=n();if(c&&c.then){if(!u(c)){o=1;break}c=c.s}}var a=new s,f=i.bind(null,a,2);return(0===o?r.then(h):1===o?c.then(m):(void 0).then(function(){(r=e())?r.then?r.then(h).then(void 0,f):h(r):i(a,1,c)})).then(void 0,f),a;function m(t){c=t;do{if(!(r=e())||u(r)&&!r.v)return void i(a,1,c);if(r.then)return void r.then(h).then(void 0,f);u(c=n())&&(c=c.v)}while(!c||!c.then);c.then(m).then(void 0,f)}function h(e){e?(c=n())&&c.then?c.then(m).then(void 0,f):m(c):i(a,1,c)}}(function(){return!r&&m>0},0,function(){return Promise.resolve(((e=0)=>new Promise(t=>setTimeout(t,e)))(Math.min(m,e.get(g)))).then(function(){return Promise.resolve(h).then(function(){n===e.get(b)?e.get.bind(e)(()=>{const n=e.get(g);m=l(e,a-Date.now());const o=(t-m)/t;v(e,Math.round((o-o%(n/t))*d)/d)}):r=1})})});return Promise.resolve(c&&c.then?c.then(o):o(c))}catch(f){return Promise.reject(f)}}).finally(y)},`${c}.startTimer`),y=t.action(e=>{b(e,e=>e+1),T(e),h&&v(e,0)},`${c}.stopTimer`),T=t.action(e=>{l(e,0)},`${c}.endTimer`);return Object.assign(l,{progressAtom:v,endTimer:T,intervalAtom:g,startTimer:w,stopTimer:y,pauseAtom:p})}});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@reatom/core"),require("@reatom/primitives"),require("@reatom/hooks")):"function"==typeof define&&define.amd?define(["exports","@reatom/core","@reatom/primitives","@reatom/hooks"],t):t((e||self).timer={},e.core,e.primitives,e.hooks)}(this,function(e,t,n,o){const r=()=>{};function i(e,t,n){if(!e.s){if(n instanceof s){if(!n.s)return void(n.o=i.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(i.bind(null,e,t),i.bind(null,e,2));e.s=t,e.v=n;const o=e.o;o&&o(e)}}const s=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){const o=new e,r=this.s;if(r){const e=1&r?t:n;if(e){try{i(o,1,e(this.v))}catch(e){i(o,2,e)}return o}return this}return this.o=function(e){try{const r=e.v;1&e.s?i(o,1,t?t(r):r):n?i(o,1,n(r)):i(o,2,r)}catch(e){i(o,2,e)}},o},e}();function u(e){return e instanceof s&&1&e.s}e.reatomTimer=(e={})=>{const{name:c=t.__count("timerAtom"),interval:a=1e3,delayMultiplier:f=1e3,progressPrecision:m=2,resetProgress:h=!0}="string"==typeof e?{name:e}:e,d=Math.pow(10,m),l=t.atom(0,`${c}Atom`),v=t.atom(0,`${c}.progressAtom`),p=t.atom(!1,`${c}.pauseAtom`),g=t.atom(a,`${c}.intervalAtom`).pipe(n.withReducers({setSeconds:(e,t)=>1e3*t})),b=t.atom(0,`${c}._versionAtom`),w=t.action((e,t)=>{t*=f;const n=b(e,e=>e+1),c=Date.now();let a=t+c,m=t,h=Promise.resolve(),w=r;l(e,m),v(e,0),p(e,!1);const y=o.onUpdate(p,(e,t)=>e.schedule(()=>{if(t){const e=Date.now();h=new Promise(t=>{w=()=>{a+=Date.now()-e,t()}})}else w()}));return e.schedule(function(){try{let r;function o(t){if(r)return t;T(e)}const c=function(e,t,n){for(var o;;){var r=e();if(u(r)&&(r=r.v),!r)return c;if(r.then){o=0;break}var c=n();if(c&&c.then){if(!u(c)){o=1;break}c=c.s}}var a=new s,f=i.bind(null,a,2);return(0===o?r.then(h):1===o?c.then(m):(void 0).then(function(){(r=e())?r.then?r.then(h).then(void 0,f):h(r):i(a,1,c)})).then(void 0,f),a;function m(t){c=t;do{if(!(r=e())||u(r)&&!r.v)return void i(a,1,c);if(r.then)return void r.then(h).then(void 0,f);u(c=n())&&(c=c.v)}while(!c||!c.then);c.then(m).then(void 0,f)}function h(e){e?(c=n())&&c.then?c.then(m).then(void 0,f):m(c):i(a,1,c)}}(function(){return!r&&m>0},0,function(){return Promise.resolve(((e=0)=>new Promise(t=>setTimeout(t,e)))(Math.min(m,e.get(g)))).then(function(){return Promise.resolve(h).then(function(){n===e.get(b)?e.get.bind(e)(()=>{const n=e.get(g);m=l(e,a-Date.now());const o=(t-m)/t;v(e,Math.round((o-o%(n/t))*d)/d)}):r=1})})});return Promise.resolve(c&&c.then?c.then(o):o(c))}catch(f){return Promise.reject(f)}}).finally(y)},`${c}.startTimer`),y=t.action(e=>{b(e,e=>e+1),T(e),h&&v(e,0)},`${c}.stopTimer`),T=t.action(e=>{l(e,0)},`${c}.endTimer`),A=t.action(e=>p(e,e=>!e),`${c}.pause`);return Object.assign(l,{progressAtom:v,endTimer:T,intervalAtom:g,startTimer:w,stopTimer:y,pauseAtom:p,pause:A})}});
//# sourceMappingURL=index.umd.js.map
{
"name": "@reatom/timer",
"version": "3.4.2",
"version": "3.5.1",
"private": false,
"sideEffects": false,
"description": "Reatom for timer",
"description": "Reatom for timers",
"source": "src/index.ts",

@@ -42,6 +42,4 @@ "exports": {

"/build",
"/package.json",
"/README.md",
"/src"
"/package.json"
]
}

@@ -6,7 +6,7 @@ Simple timer model to manage some countdown.

// all options are not required
// all options are not required, here are the defaults
const pomodoroAtom = reatomTimer({
name: 'pomodoroAtom',
interval: 1000, // tick each second
delayMultiplier: 1000, // allow to pass seconds to startTimer
interval: 1000, // `1000`ms - tick each second. Than lower, then more precise
delayMultiplier: 1000, // `1000`ms allow to pass seconds to startTimer. Use `1` to pass ms
progressPrecision: 2, // progress will be rounded to 2 digits after dot

@@ -22,13 +22,13 @@ resetProgress: true, // progress will be reset to 0 on end of timer

/** (delay - remains) / delay */
progressAtom: AtomMut<number>
progressAtom: Atom<number>
/** interval in ms */
intervalAtom: AtomMut<number> & {
setSeconds: Action<[seconds: number], number>
}
intervalAtom: AtomMut<number>
/** start timer by passed interval */
startTimer: Action<[delay: number], Promise<void>>
/** stop timer manually */
stopTimer: Action<[], void>
/** allow to pause timer */
pauseAtom: AtomMut<boolean>
/** stop timer manually */
stopTimer: Action<[], void>
/** switch pause state */
pause: Action<[], boolean>
/** track end of timer. Do not call manually! */

@@ -35,0 +35,0 @@ endTimer: Action<[], void>

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