@absolunet/ioc2.1.0

View on GitHub

Interceptor

The stdout interceptor.

Members

(static) dependencies :Array.<string>

Source:
Class dependencies: ['terminal.interceptor.capture'].

styleCleaner :function

Source:
See:
  • keepStyle
  • removeStyle
Style cleaner.

captureInterceptor :console.interceptors.CaptureInterceptor

Source:
Capture interceptor instance.

output :Array.<string>

Source:
Captured output.

interceptStdout :function

Source:
The intercept-stdout module.

ansiRegexFactory :function

Source:
The ansi-regex module.

Methods

add(closure, indexopt)

Source:
Add an stdout interceptor.
Parameters:
Name Type Attributes Default Description
closure function The interceptor closure.
index number | null <optional>
null The index where the interceptor should be inserted.
Returns:
The Interceptor service instance.
Type
console.services.Interceptor

remove(closure)

Source:
Remove an stdout interceptor.
Parameters:
Name Type Description
closure function The interceptor closure.
Returns:
The Interceptor service instance.
Type
console.services.Interceptor

removeAll()

Source:
Remove all existing interceptors.
Returns:
The Interceptor service instance.
Type
console.services.Interceptor

startCapture(muteopt)

Source:
Start capture.
Parameters:
Name Type Attributes Default Description
mute boolean <optional>
true Indicates if the console should be muted.
Returns:
The Interceptor service instance.
Type
console.services.Interceptor

stopCapture(unmuteopt)

Source:
Stop capture and get the output.
Parameters:
Name Type Attributes Default Description
unmute boolean <optional>
true Indicates if the console should be unmuted.
Returns:
The captured data.
Type
Array.<string>

enable()

Source:
Enable interceptors.
Returns:
The Interceptor service instance.
Type
console.services.Interceptor

disable()

Source:
Disable interceptors.
Returns:
The Interceptor service instance.
Type
console.services.Interceptor

mute(stateopt)

Source:
Mute stdout in process but keep interceptors enabled.
Parameters:
Name Type Attributes Default Description
state boolean <optional>
true Indicates the mute state.
Returns:
The Interceptor service instance.
Type
console.services.Interceptor

unmute()

Source:
Unmute stdout in process.
Returns:
The Interceptor service instance.
Type
console.services.Interceptor

editable(stateopt)

Source:
Allow interceptors to edit output content.
Parameters:
Name Type Attributes Default Description
state boolean <optional>
true Indicates the editable state.
Returns:
The Interceptor service instance.
Type
console.services.Interceptor

uneditable()

Source:
Deny interceptors to edit output content.
Returns:
The Interceptor service instance.
Type
console.services.Interceptor

keepStyle(stateopt)

Source:
Keep styles in content when passing it to interceptors.
Parameters:
Name Type Attributes Default Description
state boolean <optional>
true Indicates if the style should be kept.
Returns:
The Interceptor service instance.
Type
console.services.Interceptor

removeStyle()

Source:
Remove styles in content when passing it to interceptor.
Returns:
The Interceptor service instance.
Type
console.services.Interceptor