All Projects → theKashey → react-on-time

theKashey / react-on-time

Licence: MIT license
Renderless composable ⏰timers and ⏱intervals

Programming Languages

typescript
32286 projects
HTML
75241 projects

Projects that are alternatives of or similar to react-on-time

UnityTimer
Powerful and convenient library for running actions after a delay in Unity3D. Fork from akbiggs/UnityTimer. Add some useful functions.
Stars: ✭ 26 (-3.7%)
Mutual labels:  timer, delay
Arduino Timer
Non-blocking library for delaying function calls
Stars: ✭ 133 (+392.59%)
Mutual labels:  timer, delay
clappr-plugins
Main plugins for the Clappr project
Stars: ✭ 22 (-18.52%)
Mutual labels:  timer
ZYGCDTimer
GCD 定时器
Stars: ✭ 65 (+140.74%)
Mutual labels:  timer
chronoman
Utility class to simplify use of timers created by setTimeout
Stars: ✭ 15 (-44.44%)
Mutual labels:  timer
react-with-async-fonts
🔠 React module for working with custom web fonts
Stars: ✭ 22 (-18.52%)
Mutual labels:  render-prop
UT Framework
Various advanced tools built for Unreal Engine 4
Stars: ✭ 45 (+66.67%)
Mutual labels:  timer
chronocube
[UNMANTAINED]. Simple app to time your Rubik's Cube solves
Stars: ✭ 62 (+129.63%)
Mutual labels:  timer
sleepover
💤 Sleep, snooze & step methods
Stars: ✭ 13 (-51.85%)
Mutual labels:  delay
PHPBenchTime
A lightweight benchmark timer for PHP
Stars: ✭ 26 (-3.7%)
Mutual labels:  timer
hass-variables
Home Assistant variables component
Stars: ✭ 35 (+29.63%)
Mutual labels:  timer
codeforces-timer
A Google Chrome extension which adds a timer to practice timed problem solving on codeforces
Stars: ✭ 20 (-25.93%)
Mutual labels:  timer
use-countdown-timer
React hook exposing a countdown timer with optional expiration reset callbacks
Stars: ✭ 31 (+14.81%)
Mutual labels:  timer
ZLToolKit
一个基于C++11的轻量级网络框架,基于线程池技术可以实现大并发网络IO
Stars: ✭ 1,302 (+4722.22%)
Mutual labels:  timer
tiny-timer
🕑 Small countdown timer and stopwatch module.
Stars: ✭ 39 (+44.44%)
Mutual labels:  timer
Melodrumatic
Audio plugin that lets you use MIDI to pitch-shift via delay to turn unpitched audio into melodies
Stars: ✭ 26 (-3.7%)
Mutual labels:  delay
circlebars
Add circular progress bars and countdown timers easily with circlebars Created by @itaditya. Demo at >
Stars: ✭ 38 (+40.74%)
Mutual labels:  timer
Tiny-Timer
Simple timer desktop app using electron
Stars: ✭ 51 (+88.89%)
Mutual labels:  timer
CoreLooper
No description or website provided.
Stars: ✭ 34 (+25.93%)
Mutual labels:  timer
activity-timer
Activity timer powerup for Trello
Stars: ✭ 28 (+3.7%)
Mutual labels:  timer

React-on-time

Power timers to play schedule like a fiddle.

Build Status NPM version

Renderless timers and intervals for delayed rendering, complex animation and orchestration.

This works like a music on sheets. Mount -> wait -> fire -> unmount.

Super simple and predictable, but gives you ability to construct any animations "flow" you might need.

API

  1. Timeout - Timer, which will execute only once.
  • took timeout as timer duration,
  • then as optional callback and optional children as a render prop.
import {Timeout} from 'react-on-time';

<Timeout timeout={1000} then={doSomething}/>

<Timeout timeout={1000}>
 { timedout => timedout && <RenderSomething />}
</Timeout>
  1. Interval - Periodical timer. Never stops.
  • tooks delay is interval duration
  • onTick or renderprop as a callback
import {Interval} from 'react-on-time';

<Interval delay={1000} onTick={tick => doSomething(tick)}/>

<Interval delay={1000}>
 { tick => <span>#{tick}</span> }
</Interval> 
  1. Stopwatch - Continuous progress tracker, counting from 0 to 1. Based of request animation frame, could be used for animations.
  • tooks timeout as duration, and start calling onTick or children every frame.
import {Stopwatch} from 'react-on-time';

<Stopwatch timeout={1000} onTick={progress => doSomething(progress)}/>

<Stopwatch timout={1000}>
 { progress => <span>#{Math.round(100*progress)}</span> }
</Stopwatch> 
  1. Era - something which starts and ends. (Requires React 16 to work)
  • had onStart and onEnd handlers
  • accepts "normal" childrens
import {Era} from 'react-on-time';

<Era onStart={doSomething} onEnd={doSomething}>
 <Timer />
 <Interval />
</Stopwatch> 

Power usage

import {Value} from 'react-powerplug';
import {Timeout, Era} from 'react-on-time';

<Value initial={0}>
 {({value, set}) => (
   <React.Fragment>
     // mount Timer on sequence 0
     { value === 0 && <Timeout timeout={100} then={() => set(1)}/>}
   
     // on sequence 1 mount timer, and sub-timer
     { value === 1 && 
     <Fragment>
       <Timeout timeout={1000} then={() => set(1)}/>
       <Timeout timeout={100}> {
         timedOut => timedOut && (
           // this block will be mounted 100ms after
           <Era onStart={doSomething} onEnd={doSomething}>
              <Timeout timeout={100} then={doSomething}/>             
              <Timeout timeout={200} then={doSomething}/>
              <Timeout timeout={300} then={doSomething}/>
           </Era>
         ) 
       }</Timeout>
     </Fragment>
     }
     
     // sets some values to "state"
     { value===2 && <Interval duration={100} onTick={tick => setState({[tick]:true})}/>}
     // when state[10] is set - change sequence, killing interval
     { state[10] && setValue(3)} 
     
     <div> current phase is {value}</div>
   </React.Fragment>
 )}
</Value> 

Licence

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].