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

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

Module: flowcode-flow

Type: Buffer<V>

Input ports:

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

Output ports:

  • d_val: V
  • st_size: number

Buffers values. When the buffer is closed, it stores input values. When the buffer is open, it releases stored values and forwards input value. Operates in either independent or joined input mode.

import {connect} from "flowcode";
import {createBuffer} from "flowcode-flow";
const buffer = createBuffer(false);
connect(buffer.o.d_val, console.log);
buffer.i.d_val("a"); // doesn't log
buffer.i.d_val("b"); // doesn't log
buffer.i.st_open(true); // logs: "a", "b"
buffer.i.d_val("c"); // logs: "c"
Clone this wiki locally