@solid-primitives/timer

Primitive to manage timeout and interval

Usage no npm install needed!

<script type="module">
  import solidPrimitivesTimer from 'https://cdn.skypack.dev/@solid-primitives/timer';
</script>

README

@solid-primitives/timer

lerna size size stage

A timer wrapper to handle setTimeout and setInterval.

Installation

npm install @solid-primitives/timer
# or
yarn add @solid-primitives/timer

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.3

Release official version with CJS support.

1.1.0

Updated to Solid 1.3