API ReferenceGlobalsMainThreadToWorker

# Class: MainThreadToWorker

# Hierarchy

# Index

# Constructors

# Methods

# Constructors

# constructor

+ new MainThreadToWorker(callback: CommunicationInterfaceCallback, eventListener: Worker | ServiceWorker | ServiceWorkerContainer): MainThreadToWorker

Overrides CommunicationInterface.constructor

Defined in packages/workers/src/main-thread-to-worker.ts:5

Parameters:

Name Type
callback CommunicationInterfaceCallback
eventListener Worker | ServiceWorker | ServiceWorkerContainer

Returns: MainThreadToWorker

# Methods

# handleEvent

handleEvent(e: MessageEvent): void

Inherited from CommunicationInterface.handleEvent

Defined in packages/workers/src/communication-interface.ts:64

Parameters:

Name Type
e MessageEvent

Returns: void


# resolvePromises

resolvePromises(conversationId: number, data: any[]): void

Defined in packages/workers/src/main-thread-to-worker.ts:31

Parameters:

Name Type
conversationId number
data any[]

Returns: void


# sendToWorker

sendToWorker(command: WORKER_MESSAGE, data: any, resolve?: function, reject?: function): void

Defined in packages/workers/src/main-thread-to-worker.ts:11

Parameters:

command: WORKER_MESSAGE

Default value data: any= null

Optional resolve: function

▸ (...args: any[]): void

Parameters:

Name Type
...args any[]

Optional reject: function

▸ (...args: any[]): void

Parameters:

Name Type
...args any[]

Returns: void


# setEventPoster

setEventPoster(eventPoster: any): void

Inherited from CommunicationInterface.setEventPoster

Defined in packages/workers/src/communication-interface.ts:60

Parameters:

Name Type
eventPoster any

Returns: void