UNPKG

kefir

Version:

Reactive Programming library for JavaScript inspired by Bacon.js and RxJS with focus on high performance and low memory usage

26 lines (20 loc) 413 B
import timeBased from '../patterns/time-based' import emitter from '../emitter' const S = timeBased({ _name: 'withInterval', _init({fn}) { this._fn = fn this._emitter = emitter(this) }, _free() { this._fn = null this._emitter = null }, _onTick() { const fn = this._fn fn(this._emitter) }, }) export default function withInterval(wait, fn) { return new S(wait, {fn}) }