Value

value() is like control(), except it will emit the given value:
  /*!*/import { wrap, value } from '@connectv/core';
import { fromEvent } from 'rxjs';

let btn = document.getElementById('btn');

/*!*/wrap(fromEvent(btn, 'click')).to(value('HELLOW!')).subscribe(console.log);
A value() can also be the source of a flow:
  /*!*/import { value, spread, pipe } from '@connectv/core';
import { timer } from 'rxjs';
import { delayWhen } from 'rxjs/operators';

/*!*/value([1, 2, 3, 4, 5])                 //--> start with this array
.to(spread())                          //--> spread it
.to(pipe(                              //--> delay based on value
  delayWhen(                           //--> note that in pipe(), you get
    e => timer(1000 - e.value * 100))  //... emissions not values,
  )                                    //... hence 'e.value'
)
.subscribe(console.log);

Further reading




Copied to Clipboard!