Skip to content

Sampler

Dan Stocker edited this page Jun 1, 2019 · 2 revisions

Usage: createSampler<V>()

Module: flowcode-async

Type: Sampler<V>

Input ports:

  • d_val: V
  • a_smp: any

Output ports:

  • d_val: V

Forwards last input value on receiving a sampling action.

import {connect} from "flowcode";
import {createSampler} from "flowcode-async";
const sampler = createSampler();
connect(sampler.o.d_val, console.log);
sampler.i.d_val(5);
sampler.i.d_val(3);
sampler.i.a_smp(); // logs: 3

Clone this wiki locally