# Class: Task

## Task()

#### new Task()

MaiaScript multi-task library.

Source:
  - Task.js, line 24

### Methods

#### isSupported() → {boolean}

Tests whether multi-tasking is supported in the browser.

Source:
  - Task.js, line 38

##### Returns:

Returns true if supported and false otherwise.

Type
  boolean

#### new(func) → {object}

Creates a new parallel task. The thread will be created in a new scope. For communication with the master thread, the postMessage function (method) and onmessage event must be used. To finish executing the thread, the terminate method must be executed. To import a script from within the thread, you can use the importScripts function.

##### Parameters:

Name | Type | Description
--- | --- | ---
`func` | object | Function that will be executed on a new thread.

Source:
  - Task.js, line 57

##### Returns:

An object to interact with the created thread.

Type
  object

#### (inner) init()

Creates the attributes of the class.

Source:
  - Task.js, line 30