Skip to content
Dan Stocker edited this page May 30, 2019 · 1 revision

Usage: createSyncer<T>(fields: Array<keyof T>)

Module: flowcode-flow

Type: Syncer<T>

Input ports: T (user defined)

Output ports:

  • all: T (user defined)

Synchronizes input values with the same tag from all input ports and emits the synced value on a single output port.

import {connect} from "flowcode";
import {createSyncer} from "flowcode-flow";
const syncer = createSyncer(["foo", "bar"]);
connect(syncer.o.all, console.log);
syncer.i.foo("a", "2"); // doesn't log
syncer.i.foo("b", "1"); // doesn't log
syncer.i.bar("c", "2"); // logs: {foo: "a", bar: "c"} 2
Clone this wiki locally