1.0.0 • Published 8 years ago

flyd-cacheuntil v1.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

flyd-cacheUntil

Travis npm David David

Cache a stream's output until triggered by another stream. Returns an Immutable.List of cached values.

Signature

Stream<E> -> Stream -> Stream<List<E>>

Usage

import flyd from 'flyd';
import cache from 'flyd-cacheuntil';
/* or */
import cacheUntil from 'flyd-cacheuntil';

const stream = flyd.stream();
const trigger = flyd.stream();
const cachedStream = cache(stream).until(trigger);
/* or */
const cachedStream = cacheUntil(trigger, stream);

flyd.on(x => {
  console.log('Output:', x.toJS());
}, cachedStream);

stream(1)(2)(3)(4)(5);
trigger(true);

stream('a')('b')('c')('d')('e');
trigger(true);

// Output: List [ 1, 2, 3, 4, 5 ]
// Output: List [ "a", "b", "c", "d", "e" ]
1.0.0

8 years ago

0.4.0

9 years ago

0.3.0

9 years ago

0.2.1

9 years ago

0.2.0

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago