All Projects → chrisguttandin → audio-context-timers

chrisguttandin / audio-context-timers

Licence: MIT license
A replacement for setInterval() and setTimeout() which works in unfocused windows.

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects
shell
77523 projects

Projects that are alternatives of or similar to audio-context-timers

chronoman
Utility class to simplify use of timers created by setTimeout
Stars: ✭ 15 (+25%)
Mutual labels:  settimeout, setinterval, interval
timer-miniprogram
小程序定时器管理库,更合理地使用 setTimeout 和 setInterval,在页面显示时重启定时器,页面隐藏时暂停定时器,页面卸载时清除定时器
Stars: ✭ 26 (+116.67%)
Mutual labels:  settimeout, setinterval
driftless
Driftless setInterval and setTimeout replacement for Node and the browser
Stars: ✭ 67 (+458.33%)
Mutual labels:  settimeout, setinterval
timer
Timing Events tied to @gamestdio/clock
Stars: ✭ 20 (+66.67%)
Mutual labels:  settimeout, setinterval
raf-interval
setRafInterval and clearRafInterval with requestAnimationFrame - 40行代码实现的高性能动画定时器
Stars: ✭ 77 (+541.67%)
Mutual labels:  setinterval, clearinterval
MOTE
Magnitude of the Effect - An Effect Size and CI calculator
Stars: ✭ 17 (+41.67%)
Mutual labels:  interval
negasonic
This ain't Sonic Pi, but it works on the browser: www.negasonic.org
Stars: ✭ 73 (+508.33%)
Mutual labels:  web-audio
fastidious-envelope-generator
Envelope generator (aka ADSR) for the Web Audio API that aims to be free of artifacts and handle edge cases well
Stars: ✭ 56 (+366.67%)
Mutual labels:  web-audio
media-player
An modern, clean media player built using web technologies
Stars: ✭ 44 (+266.67%)
Mutual labels:  web-audio
mahler.c
Western music theory library in C99
Stars: ✭ 13 (+8.33%)
Mutual labels:  interval
glicol
(Audio) graph-oriented live coding language and music DSP library written in Rust
Stars: ✭ 853 (+7008.33%)
Mutual labels:  web-audio
AudioMasher
Generative Audio Playground
Stars: ✭ 50 (+316.67%)
Mutual labels:  web-audio
cycle-audio-graph
Audio graph driver for Cycle.js based on virtual-audio-graph
Stars: ✭ 19 (+58.33%)
Mutual labels:  web-audio
candlestick-convert
[NPM] OHLCV Candlestick Batcher/Converter
Stars: ✭ 39 (+225%)
Mutual labels:  interval
interval
This PHP library provides some tools to handle intervals. For instance, you can compute the union or intersection of two intervals.
Stars: ✭ 25 (+108.33%)
Mutual labels:  interval
dlock
Interval Lock
Stars: ✭ 19 (+58.33%)
Mutual labels:  interval
purescript-wags
Web audio graphs as a stream
Stars: ✭ 41 (+241.67%)
Mutual labels:  web-audio
neodigm55
An eclectic low-code vanilla JavaScript UX micro-library for those that defiantly think for themselves.
Stars: ✭ 14 (+16.67%)
Mutual labels:  web-audio
AdvancedTimer
AdvancedTimer implementation for Xamarin.Forms This repo is no longer maintained. New repo available.
Stars: ✭ 40 (+233.33%)
Mutual labels:  interval
fluent-plugin-http-pull
The input plugin of fluentd to pull log from rest api.
Stars: ✭ 19 (+58.33%)
Mutual labels:  interval

audio-context-timers

A replacement for setInterval() and setTimeout() which works in unfocused windows.

dependencies version

Motivation

For scripts that rely on WindowTimers like setInterval() or setTimeout() things get confusing when the site which the script is running on loses focus. Chrome, Firefox and maybe others throttle the frequency of firing those timers to a maximum of once per second in such a situation. However it is possible to schedule AudioBufferSourceNodes and listen for their onended event to achieve a similar result. This makes it possible to avoid the throttling.

Getting Started

AudioContextTimers are available as a package on npm. Simply run the following command to install it:

npm install audio-context-timers

You can then require the audioContextTimers instance from within your code like this:

import * as audioContextTimers from 'audio-context-timers';

The usage is exactly the same as with the corresponding functions on the global scope.

var intervalId = audioContextTimers.setInterval(() => {
    // do something many times
}, 100);

audioContextTimers.clearInterval(intervalId);

var timeoutId = audioContextTimers.setTimeout(() => {
    // do something once
}, 100);

audioContextTimers.clearTimeout(timeoutId);

However there are some subtle differences between AudioContextTimers and WindowTimers which are basically the same those of the worker-timers package.

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