# Class: AsyncRequest

## jala.AsyncRequest(obj, funcName, args)

This class is used to create requests of type "INTERNAL" (like cron-jobs) that are processed in a separate thread and therefor asynchronous.

## Constructor

#### new AsyncRequest(obj, funcName, args)

Creates a new AsyncRequest instance.

##### Parameters:

Name | Type | Description
--- | --- | ---
`obj` | Object | Object in whose context the method should be called
`funcName` | String | Name of the function to call
`args` | Array | Array containing the arguments that should be passed to the function (optional). This option is deprecated, instead pass the arguments directly to the #run method.

Deprecated:
  - Use the app.invokeAsync method instead (built-in into Helma as of version 1.6)
Source:
  - jala/code/AsyncRequest.js, line 53

##### Returns:

A new instance of AsyncRequest

### Methods

#### evaluate()

Starts this asynchronous request.

Deprecated:
  - Use #run instead
Source:
  - jala/code/AsyncRequest.js, line 149

#### isAlive()

Returns true if the underlying thread is alive

Source:
  - jala/code/AsyncRequest.js, line 160

##### Returns:

True if the underlying thread is alive, false otherwise.

#### run()

Starts this asynchronous request. Any arguments passed to this method will be passed to the method executed by this AsyncRequest instance.

Source:
  - jala/code/AsyncRequest.js, line 135

#### setDelay(millis)

Defines the delay to wait before evaluating this asynchronous request.

##### Parameters:

Name | Type | Description
--- | --- | ---
`millis` | Number | Milliseconds to wait

Source:
  - jala/code/AsyncRequest.js, line 125

#### setTimeout(seconds)

Sets the timeout of this asynchronous request.

##### Parameters:

Name | Type | Description
--- | --- | ---
`seconds` | Number | Thread-timeout.

Source:
  - jala/code/AsyncRequest.js, line 116