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

Reatom for timer

  • 3.4.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
152
decreased by-37.96%
Maintainers
1
Weekly downloads
 
Created
Source

Simple timer model to manage some countdown.

import { reatomTimer } from '@reatom/timer'

// all options are not required
const pomodoroAtom = reatomTimer({
  name: 'pomodoroAtom',
  interval: 1000, // tick each second
  delayMultiplier: 1000, // allow to pass seconds to startTimer
  progressPrecision: 2, // progress will be rounded to 2 digits after dot
})

Example: https://stackblitz.com/edit/reatom-timer-pomodoro?file=src%2FApp.tsx

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

FAQs

Package last updated on 17 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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