Appearance
@luminaphoto/lumina-js / Client / MessageProtocol
Class: MessageProtocol
Message protocol handler for structured Client Worker communication
Provides a typed interface for sending messages to and receiving responses from the Client Worker that uses Core.Editor internally. Handles message ID generation, timeout management, and type-safe request/response matching.
Constructors
Constructor
ts
new MessageProtocol(worker): MessageProtocol;Create a new message protocol handler
Parameters
| Parameter | Type | Description |
|---|---|---|
worker | Worker | The Web Worker instance to communicate with |
Returns
MessageProtocol
Methods
applyBrightness()
ts
applyBrightness(payload): Promise<void>;Apply brightness adjustment permanently
Parameters
| Parameter | Type | Description |
|---|---|---|
payload | PreviewBrightnessPayload | Brightness value |
Returns
Promise<void>
applyColorGrading()
ts
applyColorGrading(payload): Promise<void>;Apply color grading adjustment permanently
Parameters
| Parameter | Type | Description |
|---|---|---|
payload | PreviewColorGradingPayload | Shadow, midtone, and highlight color grading parameters |
Returns
Promise<void>
applyContrast()
ts
applyContrast(payload): Promise<void>;Apply contrast adjustment permanently
Parameters
| Parameter | Type | Description |
|---|---|---|
payload | PreviewContrastPayload | Contrast value |
Returns
Promise<void>
applyExposure()
ts
applyExposure(payload): Promise<void>;Apply exposure adjustment permanently
Parameters
| Parameter | Type | Description |
|---|---|---|
payload | PreviewExposurePayload | Exposure value in stops |
Returns
Promise<void>
applyHighlightsShadows()
ts
applyHighlightsShadows(payload): Promise<void>;Apply highlights, shadows, and midtones adjustment permanently
Parameters
| Parameter | Type | Description |
|---|---|---|
payload | PreviewHighlightsShadowsPayload | Highlights, shadows, and midtones values |
Returns
Promise<void>
applySaturation()
ts
applySaturation(payload): Promise<void>;Apply saturation adjustment permanently
Parameters
| Parameter | Type | Description |
|---|---|---|
payload | PreviewSaturationPayload | Saturation value |
Returns
Promise<void>
applyTemperature()
ts
applyTemperature(payload): Promise<void>;Apply color temperature and tint adjustment permanently
Parameters
| Parameter | Type | Description |
|---|---|---|
payload | PreviewTemperaturePayload | Temperature and tint values |
Returns
Promise<void>
applyTonalCurve()
ts
applyTonalCurve(payload): Promise<void>;Apply tonal curve adjustment permanently
Parameters
| Parameter | Type | Description |
|---|---|---|
payload | PreviewTonalCurvePayload | Tonal curve control points |
Returns
Promise<void>
cleanup()
ts
cleanup(): Promise<void>;Clean up worker resources
Returns
Promise<void>
exportImage()
ts
exportImage(payload): Promise<ExportImageResult>;Export the processed image to a specific format
Parameters
| Parameter | Type | Description |
|---|---|---|
payload | ExportImagePayload | Export format and quality settings |
Returns
Promise<ExportImageResult>
Encoded full-resolution image data
Throws
If no image is loaded or the operation times out
getPreview()
ts
getPreview(): Promise<PreviewResult>;Get preview of the current processed state
Returns
Promise<PreviewResult>
Encoded preview image data
Throws
If no image is loaded or the operation times out
initialize()
ts
initialize(payload?): Promise<void>;Initialize the Client Worker with Core.Editor
Parameters
| Parameter | Type | Description |
|---|---|---|
payload? | InitializePayload | Optional initialization configuration (logging, preview quality/size) |
Returns
Promise<void>
Throws
If WASM module fails to load or the operation times out
loadImage()
ts
loadImage(payload): Promise<LoadImageResult>;Load an image from an ArrayBuffer
Parameters
| Parameter | Type | Description |
|---|---|---|
payload | LoadImagePayload | Image buffer and format type |
Returns
Promise<LoadImageResult>
Image dimensions and metadata
Throws
If the image cannot be decoded or the operation times out
previewBrightness()
ts
previewBrightness(payload): Promise<PreviewResult>;Preview brightness adjustment without applying permanently
Parameters
| Parameter | Type | Description |
|---|---|---|
payload | PreviewBrightnessPayload | Brightness value |
Returns
Promise<PreviewResult>
Preview image data
previewColorGrading()
ts
previewColorGrading(payload): Promise<PreviewResult>;Preview color grading adjustment without applying permanently
Parameters
| Parameter | Type | Description |
|---|---|---|
payload | PreviewColorGradingPayload | Shadow, midtone, and highlight color grading parameters |
Returns
Promise<PreviewResult>
Preview image data
previewContrast()
ts
previewContrast(payload): Promise<PreviewResult>;Preview contrast adjustment without applying permanently
Parameters
| Parameter | Type | Description |
|---|---|---|
payload | PreviewContrastPayload | Contrast value |
Returns
Promise<PreviewResult>
Preview image data
previewExposure()
ts
previewExposure(payload): Promise<PreviewResult>;Preview exposure adjustment without applying permanently
Parameters
| Parameter | Type | Description |
|---|---|---|
payload | PreviewExposurePayload | Exposure value in stops |
Returns
Promise<PreviewResult>
Preview image data
previewHighlightsShadows()
ts
previewHighlightsShadows(payload): Promise<PreviewResult>;Preview highlights, shadows, and midtones adjustment without applying permanently
Parameters
| Parameter | Type | Description |
|---|---|---|
payload | PreviewHighlightsShadowsPayload | Highlights, shadows, and midtones values |
Returns
Promise<PreviewResult>
Preview image data
previewSaturation()
ts
previewSaturation(payload): Promise<PreviewResult>;Preview saturation adjustment without applying permanently
Parameters
| Parameter | Type | Description |
|---|---|---|
payload | PreviewSaturationPayload | Saturation value |
Returns
Promise<PreviewResult>
Preview image data
previewTemperature()
ts
previewTemperature(payload): Promise<PreviewResult>;Preview color temperature and tint adjustment without applying permanently
Parameters
| Parameter | Type | Description |
|---|---|---|
payload | PreviewTemperaturePayload | Temperature and tint values |
Returns
Promise<PreviewResult>
Preview image data
previewTonalCurve()
ts
previewTonalCurve(payload): Promise<PreviewResult>;Preview tonal curve adjustment without applying permanently
Parameters
| Parameter | Type | Description |
|---|---|---|
payload | PreviewTonalCurvePayload | Tonal curve control points |
Returns
Promise<PreviewResult>
Preview image data
redoOperation()
ts
redoOperation(nodeType): Promise<PreviewResult>;Redo the next undone operation of the specified type
Parameters
| Parameter | Type | Description |
|---|---|---|
nodeType | NodeType | The operation type to redo |
Returns
Promise<PreviewResult>
Preview image data after the redo
terminate()
ts
terminate(): Promise<void>;Terminate the worker and clean up all resources
Returns
Promise<void>
undoOperation()
ts
undoOperation(nodeType): Promise<PreviewResult>;Undo the last operation of the specified type
Parameters
| Parameter | Type | Description |
|---|---|---|
nodeType | NodeType | The operation type to undo |
Returns
Promise<PreviewResult>
Preview image data after the undo