JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 38491
  • Score
    100M100P100Q160180F
  • License MIT

Primitive to manage timeout and interval

Package Exports

  • @solid-primitives/timer

Readme


Name: timer Stage: 3 Package: "@solid-primitives/timer" Primitives: createTimer

@solid-primitives/timer

lerna size size

A timer wrapper to handle setTimeout and setInterval.

createTimer - A single timer that can handle timeouts and intervals.

How to use it

let [count, setCount] = createSignal(0);
createTimer(() => setCount(count() + 1), 500, Schedule.Interval);
<h1>Counting up: {count()}</h1>;

Demo

You may view a working example here: https://codesandbox.io/s/solid-primitives-timer-6n7dt?file=/src/index.tsx

Changelog

Expand Changelog

0.0.100

First commit of the timer primitive.

0.0.107

Patched an issue with clear on clean-up.

1.0.1

Release official version with CJS support.