Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Overview

Excerpt

Backport allows you to implement missing functions by providing your own functions.

Availability

Backport v0.1 and above.

Syntax

Code Block
if (!backport(functionName)) { // function is missing, need to add it
  var status = backport(functionName,function(...) {
    // do stuff
  });
  // status === 1 indicates that all went well
}
 
// then elsewhere in the code access the function as usual
var foo = functionName(params);

Parameters

ParameterTypeMandatoryDescriptionBackport version
functionNameString(tick)The name of the function to check/create0.1
<function>Function(tick)The function to assign to functionName0.1

Return values

See status return values.

Examples

See the following backport scripts for great examples:

  • objFromId.js – very simple example of function addition
  • orderDroid.js – more advanced function addition/upgrade, also has a little API to extend what orders it can accept

See also