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

Usage: createGate<V>(open?: boolean)

Module: flowcode-flow

Type: Gate<V>

Input ports:

  • all: {d_val: V, st_open: boolean}
  • d_val: V
  • st_open: boolean

Output ports:

  • b_all: {d_val: V, st_open: boolean}
  • b_d_val: V
  • d_val: V

Forwards input value when gate is open. Operates in either independent or joined input mode. Bounces input when gate is closed.

import {connect} from "flowcode";
import {createGate} from "flowcode-flow";
const gate = createGate(false);
connect(gate.o.d_val, console.log);
gate.i.d_val("a"); // doesn't log 
gate.i.st_open(true);
gate.i.d_val("b"); // logs: "b"

Clone this wiki locally