Pipe

Pipes provide a callback system where functions can be chained. The result of one callback can be passed to another in a linear chain.

Pipes make it possible to write callback-based code that shows the underlying sequence of events:

root.focusChild()
    .then(child => child.scrollIntoView())
    .then(a => node.flash(1.second))

In Fluid, they are most often used to operate on TreeAction. A tree action callback will fire when the action finishes.

This pattern resembles a commandline pipelines, where a process "pipes" data into another. It may be a bit similar to [JavaScript Promises]Promise, but unlike Promises, pipes may trigger a callback multiple times, as opposed to just once.

pipeline: https://en.wikipedia.org/wiki/Pipeline_(Unix)#Pipelines_in_command_line_interfaces Promise: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise

Constructors

this
this(Delegate callback)

Set up a pipe, use a callback to process data that comes through.

Members

Aliases

Delegate
alias Delegate = Return delegate(Input) @(safe)
Undocumented in source.
Input
alias Input = Args
Undocumented in source.
Output
alias Output = ToParameter!Return
Undocumented in source.

Functions

opCall
void opCall(Input input)

Push data down the pipe.

subscribe
void subscribe(Subscriber!Output subscriber)

Subscribe to the data sent by this publisher. Only one subscriber can be assigned to a pipe at once.

Meta