Hemi JavaScript Framework

Hemi.task

Description

The Task Service coordinates various actions and handlers and dependencies. Tasks are excellent bootstraps for multiple asynchronous operations.

Class Index

static Hemi.task.service

version 3.1.0

Static instance of serviceImpl.

Hemi.task.TaskServiceImpl

version 3.1.0

A service for managing asynchronous and dependency-driven actions.

Index

Object Index

Method Index

Objects

Task

Properties

Methods

Methods

addTask

Adds a new task.

Syntax

o = addTask( n, at, a, ht, h, f )

Parameters

Returns

o as TaskObject: New Task object.

addTaskDependency

Adds a dependency to a Task object.

Syntax

a = addTaskDependency( t, d )

Parameters

Returns

a as boolean: Bit indicating whether the dependency was added.

addTaskLoader

Convenience method for adding a task that overrides the default task loader name.

Syntax

o = addTaskLoader( n, at, a, ht, h, f )

Parameters

Returns

o as TaskObject: New Task object.

clearAllTasks

Clears all tasks. Any task that is still in operation will be unceremoniously removed from operation, as opposed to clearTask which allows the task to continue current operation until it's finished.

Syntax

void clearAllTasks( )

clearDependency

Removes the specified dependency, regardless of whether it was resolved or completed.

Syntax

void clearDependency( v )

Parameters

clearTask

Clears the specified task and removes the TaskObject. If the task is still in operation, auto destroy is enabled and the task will continue to function.

Syntax

t = clearTask( v )

Parameters

Returns

t as boolean: Returns true if the task was cleared or slated to be cleared, or otherwise false.

destroy

Prepares this object for destruction. All tasks will be cleared.

Syntax

void destroy( )

doTransaction

Invoked by TransactionService as a TransactionParticipant.

Syntax

void doTransaction( s, p )

Parameters

endTask

End task returns all named dependencies for the task, and then invokes clearTask.

Syntax

t = endTask( v, b )

Parameters

Returns

t as boolean: Returns true if the task was ended.

endTransaction

Invoked by TransactionService as a TransactionParticipant.

Syntax

void endTransaction( s, p )

Parameters

executeTask

Forces the task action to be executed.

Syntax

b = executeTask( o )

Parameters

Returns

b as boolean: Bit indicating whether the task action was executed.

executeTaskByName

Forces the task action to be executed.

Syntax

b = executeTaskByName( n )

Parameters

Returns

b as boolean: Bit indicating whether the task action was executed.

executeTaskHandler

Forces the task handler to be executed, and positioning the task to be in a completed state.

Syntax

b = executeTaskHandler( o )

Parameters

Returns

b as boolean: Bit indicating whether the handler was executed.

executeTaskHandlerByName

Forces the task handler to be executed, and positioning the task to be in a completed state.

Syntax

b = executeTaskHandlerByName( n )

Parameters

Returns

b as boolean: Bit indicating whether the handler was executed.

executeTaskLoader

Convenience method for adding and immediately executing a task. Used as a driver to launch other task lists by the Space service. Invokes addTaskLoader.

Syntax

o = executeTaskLoader( n, at, a, ht, h, f )

Parameters

Returns

o as TaskObject: New Task object.

getTask

Returns the specified Task object.

Syntax

e = getTask( i )

Parameters

Returns

e as Task: XHTMLForm object.

getTaskByName

Returns the specified Task object.

Syntax

e = getTaskByName( n )

Parameters

Returns

e as Task: Task object.

getTaskDepends

Returns a copy of the dependency names for this task.

Syntax

a = getTaskDepends( t )

Parameters

Returns

a as array: Array of task dependency names.

getTasks

Returns an array of Task objects.

Syntax

a = getTasks( )

Returns

a as array: Array of Task objects.

importTaskFromXML

Creates a TaskObject from the specified XML Node.

Syntax

void importTaskFromXML( n, o, d, b )

Parameters

isExternalLoaded

Returns true if any external task list has been loaded, false otherwise.

Syntax

b = isExternalLoaded( )

Returns

b as boolean: Bit indicating whether an external task list has been loaded.

isTask

Returns true if the specified name exists.

Syntax

b = isTask( i )

Parameters

Returns

b as boolean: Bit indicating whether the specified object name exists.

isTaskComplete

Returns whether or not the task was completed.

Syntax

c = isTaskComplete( o )

Parameters

Returns

c as boolean: Bit indicating whether the task was completed.

newTaskObject

Creates a new task object.

Syntax

t = newTaskObject( n, at, a, ht, h, k, i, r, p )

Parameters

Returns

t as TaskObject: Returns a new TaskObject.

returnDependency

Returns the specified depency name or dependent task name, causing all tasks identifying this dependency to be updated. If the returned dependency is a task, the task is forced closed regardless of whether its action or handler were executed.

Syntax

void returnDependency( v )

Parameters

serveTaskTransaction

Forces the transaction that drives the Task object to serve the corresponding TransactionPacket. This is used when a Task object is thought to be stuck due to some uncaught exception in its action, handler, or dependencies.

Syntax

void serveTaskTransaction( o )

Parameters

sigterm

Sends a termination signal to this object.

Syntax

void sigterm( )

startTransaction

Invoked by TransactionService as a TransactionParticipant.

Syntax

void startTransaction( s, p )

Parameters