Class: Pad
One end of a connection between two elements.
Constructors
Constructor
new Pad(
direction,element,capabilities):Pad
Parameters
direction
"sink" | "src"
element
capabilities
Returns
Pad
Properties
capabilities
readonlycapabilities:Capabilities
direction
readonlydirection:"sink"|"src"
element
readonlyelement:BaseElement
peers
readonlypeers:Pad[] =[]
Connected pads: sink pads for a source pad, source pads for a sink pad.
Methods
connect()
connect(
element,onError):void
Internal
Connects this source pad to a new sink pad on element, which then emits padadded.
Parameters
element
BaseElement & object
onError
(error, destination) => void
Returns
void
deliverEvent()
deliverEvent(
event):Promise<void>
Internal
Delivers an event; unhandled ones land behind what the element already wrote.
Parameters
event
Returns
Promise<void>
holdWrites()
holdWrites(): () =>
void
Internal
Holds writes until the returned function is called, once the pad is routed.
Returns
() => void
onEvent()
onEvent(
listener): () =>void
Sink pads only. Return true when the event is handled; false forwards it past this pad's element.
Parameters
listener
(event) => boolean
Returns
() => void
onSignal()
onSignal(
listener): () =>void
Return true when the signal is handled; false forwards it past this pad's element.
Parameters
listener
(signal) => boolean
Returns
() => void
signal()
signal(
signal):boolean
Delivers signal immediately to the connected pads: upstream from a sink pad, downstream from a source pad, ahead of anything written. An element that doesn't handle it passes it on through its other pads. Returns whether any element handled it.
Parameters
signal
Returns
boolean
unlink()
unlink(
peer):void
Internal
Parameters
peer
Pad
Returns
void
write()
write(
item):Promise<void>
Source pads only. Resolves once every connection has room, for a frame once each took it: await it to apply backpressure. A frame goes to the first connection and a clone to each other one, and is closed without any.
Parameters
item
Returns
Promise<void>