RoadmapShopEvents
Skip to main content

Home > @rushstack/terminal > CallbackWritable

CallbackWritable class

This class enables very basic TerminalWritable.onWriteChunk() operations to be implemented as a callback function, avoiding the need to define a subclass of TerminalWritable.

Signature:

export declare class CallbackWritable extends TerminalWritable 

Extends: TerminalWritable

Remarks

CallbackWritable is provided as a convenience for very simple situations. For most cases, it is generally preferable to create a proper subclass.

Constructors

ConstructorModifiersDescription
(constructor)(options)Constructs a new instance of the CallbackWritable class

Properties

PropertyModifiersTypeDescription
isOpenreadonlyboolean

This property is initially true when the object is constructed, and becomes false when close() is called.

(Inherited from TerminalWritable)

preventAutoclosereadonlyboolean(Inherited from TerminalWritable)

Methods

MethodModifiersDescription
close()

Calling this method flushes any remaining outputs and permanently transitions the TerminalWritable to a "closed" state, where no further chunks can be written.

(Inherited from TerminalWritable)

onClose()protected

Subclasses can override this empty method to perform additional operations such as closing a file handle.

(Inherited from TerminalWritable)

onWriteChunk(chunk)protected
writeChunk(chunk)

Upstream objects call this method to provide inputs to this object.

(Inherited from TerminalWritable)