Packagesystem.process
Classpublic class BindTask
InheritanceBindTask Inheritance Task Inheritance Object

This process wraps a function in another, locking its execution scope to a specific object.

Example :

     import core.dump ;
     import system.process.Action ;
     import system.process.Bind ;
     
     var finish:Function = function( action:Action ):void
     {
         trace ( "finish" ) ;
     }
     
     var start:Function = function( action:Action ):void
     {
         trace ( "start" ) ;
     }
     
     var execute:Function = function( ...args:Array ):void
     {
         trace ( this + " execute " + dump(arguments) ) ;
     }
     
     var scope:Object = 
     {
         toString : function():String
         {
             return "scope" ;
         }
     };
     
     var wrapper:BindTask = new BindTask( execute, scope , "hello world" ) ;
     
     wrapper.startIt.connect( start ) ;
     wrapper.finishIt.connect( finish ) ;
     
     wrapper.run() ;
     

See also

core.functors.bind


Public Properties
 PropertyDefined By
  args : Array
The array of all optionals arguments to inject in the method when is executed.
BindTask
 InheritedfinishIt : Signaler
This signal emit when the notifyFinished method is invoked.
Task
 Inheritedlogger : Logger
Determinates the internal Logger reference of this Loggable object.
Task
  method : Function
The method to execute.
BindTask
 Inheritedphase : String
[read-only] The current phase of the action.
Task
 Inheritedrunning : Boolean
[read-only] Indicates true if the process is in progress.
Task
  scope : *
The scope reference of the function to execute.
BindTask
 InheritedstartIt : Signaler
This signal emit when the notifyStarted method is invoked.
Task
Public Methods
 MethodDefined By
  
BindTask(method:Function, scope:*, ... arguments)
Creates a new BindTask instance.
BindTask
  
clone():*
[override] Returns a shallow copy of this object.
BindTask
 Inherited
isLocked():Boolean
Returns true if the object is locked.
Task
 Inherited
lock():void
Locks the object.
Task
 Inherited
Notify an ActionEvent when the process is finished.
Task
 Inherited
Notify an ActionEvent when the process is started.
Task
  
run(... arguments):void
[override] Run the process.
BindTask
 Inherited
unlock():void
Unlocks the display.
Task
Protected Methods
 MethodDefined By
 Inherited
setRunning(b:Boolean):void
Changes the running property value.
Task
Property Detail
argsproperty
public var args:Array

The array of all optionals arguments to inject in the method when is executed.

methodproperty 
public var method:Function

The method to execute.

scopeproperty 
public var scope:*

The scope reference of the function to execute.

Constructor Detail
BindTask()Constructor
public function BindTask(method:Function, scope:*, ... arguments)

Creates a new BindTask instance.

Parameters
method:Function — The method invoked in this process.
 
scope:* (default = NaN) — The scope of method to execute.
 
... arguments — The optional argument to inject in the method.
Method Detail
clone()method
override public function clone():*

Returns a shallow copy of this object.

Returns
* — a shallow copy of this object.
run()method 
override public function run(... arguments):void

Run the process.

Parameters

... arguments