Skip to main content

WorkerMessage

@webda/workout


Class: WorkerMessage

Defined in: packages/workout/src/core.ts:427

Represents a message emitted by WorkerOutput and consumed by loggers

Indexable​

[key: string]: any

Additional arbitrary properties merged from infos

Constructors​

Constructor​

new WorkerMessage(type, workout, infos?): WorkerMessage

Defined in: packages/workout/src/core.ts:457

Create a new WorkerMessage

Parameters​

type​

WorkerMessageType

Event type discriminator

workout​

WorkerOutput

WorkerOutput instance whose current state is captured

infos?​

any = {}

Additional properties to merge into the message

Returns​

WorkerMessage

Properties​

context?​

optional context?: object

Defined in: packages/workout/src/core.ts:449

Source location of the log call (populated when addLogProducerLine is enabled)

column?​

optional column?: number

file?​

optional file?: string

function?​

optional function?: string

line?​

optional line?: number


currentProgress?​

optional currentProgress?: string

Defined in: packages/workout/src/core.ts:435

UID of the currently active progress (if any)


data?​

optional data?: string

Defined in: packages/workout/src/core.ts:439

Raw program output attached to "output" messages


groups​

groups: string[]

Defined in: packages/workout/src/core.ts:429

Active log group stack at the time of emission


input?​

optional input?: WorkerInput

Defined in: packages/workout/src/core.ts:447

Input request/response attached to input-related messages


log?​

optional log?: WorkerLog

Defined in: packages/workout/src/core.ts:437

Log entry attached to "log" messages


pid​

pid: number

Defined in: packages/workout/src/core.ts:443

PID of the process that emitted the message


progresses​

progresses: object = {}

Defined in: packages/workout/src/core.ts:433

Snapshot of all active progress indicators at emission time

Index Signature​

[key: string]: WorkerProgress


timestamp​

timestamp: number

Defined in: packages/workout/src/core.ts:441

Unix timestamp (ms) when the message was created


type​

type: WorkerMessageType

Defined in: packages/workout/src/core.ts:431

Discriminator that identifies the kind of event

Methods​

fromJSON()​

static fromJSON(json): WorkerMessage

Defined in: packages/workout/src/core.ts:474

Deserialize a WorkerMessage from JSON

Parameters​

json​

string

JSON string representation of a WorkerMessage

Returns​

WorkerMessage

A fully reconstructed WorkerMessage instance with proper types