Skip to main content

WorkerMessage

@webda/workout


Class: WorkerMessage

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

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:472

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:464

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:450

UID of the currently active progress (if any)


data?​

optional data?: string

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

Raw program output attached to "output" messages


groups​

groups: string[]

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

Active log group stack at the time of emission


input?​

optional input?: WorkerInput

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

Input request/response attached to input-related messages


log?​

optional log?: WorkerLog

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

Log entry attached to "log" messages


pid​

pid: number

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

PID of the process that emitted the message


progresses​

progresses: object = {}

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

Snapshot of all active progress indicators at emission time

Index Signature​

[key: string]: WorkerProgress


timestamp​

timestamp: number

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

Unix timestamp (ms) when the message was created


type​

type: WorkerMessageType

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

Discriminator that identifies the kind of event

Methods​

fromJSON()​

static fromJSON(json): WorkerMessage

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

Deserialize a WorkerMessage from JSON

Parameters​

json​

string

JSON string representation of a WorkerMessage

Returns​

WorkerMessage

A fully reconstructed WorkerMessage instance with proper types