Class: Twisters ‹Meta

Type parameters

Meta

Hierarchy

Index

Constructors

Properties

Methods

Constructors

constructor

+ new Twisters(options?: Partial‹TwistersOptions‹Meta››, buffer?: TwistersBuffer): Twisters

Create new Twisters instance

Parameters:

Name Type Description
options? Partial‹TwistersOptions‹Meta›› -
buffer? TwistersBuffer DEPRECATED Please define buffer in options instead of passing it as the second constructor parameter

Returns: Twisters

Properties

lineBuffer

lineBuffer: TwistersBuffer

deprecated Please reference options.buffer instead


options

options: TwistersOptions‹Meta›


spinnerLoop

spinnerLoop: SpinnerLoop

Methods

flush

flush(): void

Flush messages to stream.

remarks This is called automatically if the flushInactive option is true. Otherwise this must be called manually when all messages have finished.

Returns: void


forEachMessage

forEachMessage(callback: ForEachMessageCallback‹Meta›): void

Iterate over buffered messages and invoke the callback for each one.

Parameters:

Name Type
callback ForEachMessageCallback‹Meta›

Returns: void


hasActiveMessage

hasActiveMessage(): boolean

Returns true if any of the buffered messages are active, otherwise false.

Returns: boolean


log

log(text: string, messageOpt?: Partial‹Message‹Meta››): Message‹Meta›

Log an inactive message (convenience function equivalent to put('text', { active: false }))

Parameters:

Name Type
text string
messageOpt? Partial‹Message‹Meta››

Returns: Message‹Meta›


messageCount

messageCount(): number

Get buffered message count.

Returns: number


pick

pick(name: string): Message‹Meta› | undefined

Get buffered message by name.

Parameters:

Name Type
name string

Returns: Message‹Meta› | undefined


put

put(name: string, messageOpt?: Partial‹Message‹Meta››): Message‹Meta›

Add/update a message

remarks Message content is not cached by default. This means that message text must be provided to subsequent put calls, even if the text is unchanged. See custom-cache.js example to update messages using only changed attributes.

Parameters:

Name Type
name string
messageOpt? Partial‹Message‹Meta››

Returns: Message‹Meta›


remove

remove(name: string): Message‹Meta› | undefined

Remove a buffered message by name (convenience function equivalent to put('name', { removed: true }))

Parameters:

Name Type
name string

Returns: Message‹Meta› | undefined

The existing message that was removed or undefined if no message was found for the provided key