Class Index | File Index

Classes


Class baja.BatchResolve


Extends BaseBajaObj.
BatchResolve is used to resolve a list of ORDs together.

This method should always be used if multiple ORDs need to be resolved at the same time.
Defined in: ord.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Method Summary
Method Attributes Method Name and Description
 
each(func)
For each resolved target, call the specified function.
 
get(index)
Return the resolved object at the specified index.
 
getFail(index)
Return the error for a particular ORD that failed to resolve or null for no error.
 
getOrd(index)
Return the ORD at the specified index or null if the index is invalid.
 
getTarget(index)
Return the ORD Target at the specified index.
 
Return an array of resolved objects.
 
Return an array of resolved ORD Targets.
 
isResolved(index)
Return true if the ORD at the specified index has successfully resolved.
 
resolve(obj)
Batch resolve an array of ORDs.
 
size()
Return the number of items in the Batch.
Methods borrowed from class BaseBajaObj:
equals, valueOf
Class Detail
baja.BatchResolve(ords)
Parameters:
{Array} ords
an array of ORDs to resolve. The array can be Strings or baja.Ord.
Method Detail
each(func)
For each resolved target, call the specified function.

If any ORDs failed to resolve, an error will be thrown.

When the function is called, the 'this' will be the resolved Component's target. The target's object will be passed as a parameter into the function.

Parameters:
{Function} func
Throws:
{Error}
thrown if any of the ORDs failed to resolve

get(index)
Return the resolved object at the specified index.

If the ORD failed to resolve, an error will be thrown.

Parameters:
{Number} index
Throws:
{Error}
thrown if the ORD failed to resolve
Returns:
the resolved object

{Error} getFail(index)
Return the error for a particular ORD that failed to resolve or null for no error.
Parameters:
{Number} index
Returns:
{Error} the error or null if no error.

{baja.Ord} getOrd(index)
Return the ORD at the specified index or null if the index is invalid.
Parameters:
{Number} index
Returns:
{baja.Ord}

{OrdTarget} getTarget(index)
Return the ORD Target at the specified index.

If the ORD failed to resolve, an error will be thrown.

Parameters:
{Number} index
Throws:
{Error}
thrown if ORD failed to resolve
Returns:
{OrdTarget} the ORD Target

{Array} getTargetObjects()
Return an array of resolved objects.

If any of the ORDs failed to resolve, an error will be thrown.

Throws:
{Error}
thrown if any ORDs failed to resolve
Returns:
{Array} an array of objects

{Array} getTargets()
Return an array of resolved ORD Targets.

If any of the ORDs failed to resolve, an error will be thrown.

Throws:
{Error}
thrown if any ORDs failed to resolve
Returns:
{Array} an array of ORD Targets

{Boolean} isResolved(index)
Return true if the ORD at the specified index has successfully resolved.
Parameters:
{Number} index
Returns:
{Boolean}

resolve(obj)
Batch resolve an array of ORDs.

A Batch Resolve should be used whenever more than one ORD needs to resolved.

Any network calls that result from processing an ORD are always asynchronous.

This method can only be called once per BatchResolve instance.

An Object Literal is used to supply the method's arguments. For example...

  var r = baja.BatchResolve(["station:|slot:/Ramp", "station:|slot:/SineWave"]);
  var sub = new baja.Subscriber(); // Also batch subscribe all resolved Components
  
  r.resolve({
    ok: function () {
      // Get resolved objects
      var objs = this.getTargetObjects();
    },
    fail: function (err) {
      // Called if any of the ORDs fail to resolve
    },
    subscriber: sub
  });

  // Or use the each method (will only be called if all ORDs resolve). Each will
  // be called for each target.
  r.resolve({
    each: function () {
      baja.outln("Resolved: " + this.toPathString());
    },
    fail: function (err) {
      // Called if any of the ORDs fail to resolve
    },
    subscriber: sub
  });
Parameters:
{Object} obj Optional
the Object Literal that contains the method's arguments.
{Function} obj.ok Optional
the ok function called once all of the ORDs have been successfully resolved. When the function is called, 'this' is set to the BatchResolve object.
{Function} obj.fail Optional
the fail function called if any of the ORDs fail to resolve. The first error found is pass as an argument to this function.
obj.base Optional
the base Object to resolve the ORDs against.
{baja.Subscriber} obj.subscriber Optional
if defined, any mounted Components are subscribed using this Subscriber.
{Boolean} obj.lease Optional
if defined, any resolved and mounted components are leased.
{Number|baja.RelTime} obj.leaseTime Optional
the lease time used for leasing Components.
See:
baja.Ord

{Number} size()
Return the number of items in the Batch.
Returns:
{Number}

Documentation generated by JsDoc Toolkit 2.3.2