Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

Overview

Backport allows you to remove deprecated JS API features.

This should only be used if the newer (replacement) feature has already been backported.

By removing deprecated features you can more easily check that your script isn't relying on them sooner rather than later.

Accessing removed features will cause exceptions (errors) so you can quickly spot if your script is using them (the filename and line number will usually be shown).

The feature is not actually removed (it's not possible to do so) - instead, it's replaced with a value of undefined.

Availability

Backport v0.1 and above.

Syntax

// remove a deprecated feature
var returnValue = backport(name,null);

Parameters

ParameterTypeMandatoryDescriptionBackport version
nameString(tick)The name of the feature as a string (in quotes).0.1
nullNull(tick)Specifying a value of null or undefined causes feature with 'name' to be removed.0.1

Return value

ValueTypeDescriptionBackport verison
<status>VariantThe new status of the constant (see status return values).0.1

Example

// droidFromId() was deprecated in Warzone 3.1 Beta 2, it was replaced with objFromId()
 
// we need to make sure the new function, objFromId() exists before deleting droidFromId()
if (!backport("objFromId") && backport("droidFromId")) { // we're on 3.1 Beta 1
  // objFromId() is exactly the same as droidFromId() so we can backport it easily
  backport("objFromId",droidFromId); // returns -1 === feature added by backport
}
 
// now we know objFromId() exists, we can delete droidFromId()
backport("droidFromId",null); // returns null === feature removed by backport

See also

  • No labels