(info) This AI is still in early stages of development.

Define API

An API for adding, removing or replacing properties on the global object / scope.

 

Overview

The primary purpose of the Define API is to alter the native Javascript API provided by Warzone 2100.

The JS API defines all it's constants, globals and functions as read-only, non-configurable properties on the global object. As such, they can only be altered by variables and constants in the global scope. Unfortunately, if you try defining a variable or constant in the global scope, and there is an immutable property of the same name on the global object, an error will be thrown – Javascript detects that you are doing something potentially stupid and steps in to block the action.

The Define API wraps some JS trickery in to a robust and reliable API which makes it trivially easy to work around these issues. Furthermore, you don't have to script your defines in the context of the global scope - you can put them in closures to keep them neatly packaged and avoid spamming the global object and scope with countless internal variables.

 

Availability BETA

Requires:

Define API

Topics:

  • Define()Add, remove or redefine a property on the global scope, overriding any native property of the same name on the global object...
  • Define API DiagnosticsDiagnostic routines for Define API...
  • Define ScriptsA library of ready made scripts for the Define API...