Class: Task

Mobizen.Socket.Channel~Task

The Task Manager of Sequence.

new Task(options)

Name Type Description
options object

The task options.

Name Type Description
type string

The transfer type request or stream.

channel string

The name of channel of socket.

timeout number optional

Add an error event of timeout.

pause function optional

Add a method of pause.

resume function optional

Add a method of resume.

cancel function optional

Add a method of cancel.

Extends

Members

cancel function

Add a method of cancel if use otherwise just void.

channel string

The name of channel of socket.

pause function

Add a method of pause if use otherwise just void.

resume function

Add a method of resume if use otherwise just void.

timer number

Add an error event of timeout if use.

type string

The transfer type request or stream.

Methods

inherited emit(type){boolean}

Execute each of the listeners in order with the supplied arguments.

Name Type Description
type string

type of event

Returns:
Type Description
boolean true if event had listeners, false otherwise.

inherited listeners(type){array}

Name Type Description
type string

type of event

Returns:
Type Description
array array of listeners for the specified event.

inherited off(type, listener){Mobizen.Event}

Remove a listener from the listener array for the specified event. Caution: changes array indices in the listener array behind the listener.

Calling .off() with no arguments removes all handlers attached to the elements. if use one argument those of the specified event. It's not a good idea to remove listeners that were added elsewhere in the code, especially when it's on an emitter that you didn't create (e.g. sockets or file streams).

Name Type Description
type string optional

type of event

listener function optional

callback

Throws:
Will throw an error if the listener argument is not a function.
Returns:
Type Description
Mobizen.Event emitter, so calls can be chained.

inherited on(type, listener){Mobizen.Event}

Adds a listener to the end of the listeners array for the specified event. No checks are made to see if the listener has already been added. Multiple calls passing the same combination of event and listener will result in the listener being added multiple times.

Name Type Description
type string

type of event

listener function

callback

Throws:
Will throw an error if the listener argument is not a function.
Returns:
Type Description
Mobizen.Event emitter, so calls can be chained.

inherited once(type, listener){Mobizen.Event}

Adds a one time listener for the event. This listener is invoked only the next time the event is fired, after which it is removed.

Name Type Description
type string

type of event

listener function

callback

Throws:
Will throw an error if the listener argument is not a function.
Returns:
Type Description
Mobizen.Event emitter, so calls can be chained.

ondata(arg1, arg2, arg3)

Name Type Description
arg1 * optional

receive data 1

arg2 * optional

receive data 2

arg3 * optional

receive data 3

onend(arg1, arg2, arg3)

Name Type Description
arg1 * optional

receive data 1

arg2 * optional

receive data 2

arg3 * optional

receive data 3

onerror(type, data)

Name Type Description
type string

typeof error

data * optional

receive data

inherited pipe(dest, always){Mobizen.Event}

This method pulls all the data out of a readable stream, and writes it to the supplied destination, automatically managing the flow so that the destination is not overwhelmed by a fast readable stream.

Name Type Description
dest Mobizen.Event

destination

always boolean optional
Returns:
Type Description
Mobizen.Event dest emitter, so calls can be chained.
Example
A.pipe(B).pipe(C);

inherited virtual unpipe(dest){Mobizen.Event}

This method will remove the hooks set up for a previous pipe() call. If the destination is not specified, then all pipes are removed. If the destination is specified, but no pipe is set up for it, then this is a no-op.

Name Type Description
dest Mobizen.Event

destination

Returns:
Type Description
Mobizen.Event dest emitter, so calls can be chained.
comments powered by Disqus