# Global

##

### Methods

#### addTask(taskType, data, priority, transferList) → {*}

Function to add a decode task to be performed

##### Parameters:

Name | Type | Default | Description
--- | --- | --- | ---
`taskType` |  |  | the taskType for this task
`data` |  |  | data specific to the task
`priority` |  | 0 | optional priority of the task (defaults to 0), > 0 is higher, < 0 is lower
`transferList` |  |  | optional array of data to transfer to web worker

Source:
  - webWorker/webWorkerManager.js, line 198

##### Returns:

Type
  *

#### cancelTask(taskId, reason)

Cancels a queued task and rejects

##### Parameters:

Name | Type | Description
--- | --- | ---
`taskId` |  | the taskId to cancel
`reason` |  | optional reason the task was rejected

Source:
  - webWorker/webWorkerManager.js, line 282

##### Returns:

boolean - true on success, false if taskId not found

#### (async) decode(byteArray) → {Promise.<object>}

Decode image.

##### Parameters:

Name | Type | Description
--- | --- | ---
`byteArray` | Uint8Array | Image array

Source:
  - webWorker/decoders/decoderAbstract.js, line 17

##### Returns:

decoded array and frame information

Type
  Promise.<object>

#### getStatistics()

Function to return the statistics on running web workers

Source:
  - webWorker/webWorkerManager.js, line 302

##### Returns:

object containing statistics

#### handleMessageFromWorker(msg)

Function to handle a message from a web worker

##### Parameters:

Name | Type | Description
--- | --- | ---
`msg` |  |

Source:
  - webWorker/webWorkerManager.js, line 82

#### initialize(configObject)

Initialization function for the web worker manager - spawns web workers

##### Parameters:

Name | Type | Description
--- | --- | ---
`configObject` |  |

Source:
  - webWorker/webWorkerManager.js, line 134

#### loadWebWorkerTask(sourcePath, taskConfig)

dynamically loads a web worker task

##### Parameters:

Name | Type | Description
--- | --- | ---
`sourcePath` |  |
`taskConfig` |  |

Source:
  - webWorker/webWorkerManager.js, line 164

#### setTaskPriority(taskId, priority)

Changes the priority of a queued task

##### Parameters:

Name | Type | Default | Description
--- | --- | --- | ---
`taskId` |  |  | the taskId to change the priority of
`priority` |  | 0 | priority of the task (defaults to 0), > 0 is higher, < 0 is lower

Source:
  - webWorker/webWorkerManager.js, line 249

##### Returns:

boolean - true on success, false if taskId not found

#### spawnWebWorker()

Spawns a new web worker

Source:
  - webWorker/webWorkerManager.js, line 110

#### startTaskOnWebWorker()

Function to start a task on a web worker

Source:
  - webWorker/webWorkerManager.js, line 33

#### terminateAllWebWorkers()

Terminate all running web workers.

Source:
  - webWorker/webWorkerManager.js, line 151

#### (async) transform(sopInstanceUID, decodedFrame) → {Promise.<Buffer>}

Transform image. The transform is applied only is iccProfiles are available. Otherwise the function return the original decoded frame.

##### Parameters:

Name | Type | Description
--- | --- | ---
`sopInstanceUID` | string | SOP Instance UID of current image that should be transformed
`decodedFrame` | Buffer | decoded Frame

Source:
  - webWorker/transformers/transformerICC.js, line 80

##### Returns:

transformed buffer

Type
  Promise.<Buffer>