This AI is still in early stages of development.
Define()
- Aubergine
Syntax
Define(); // returns an object describing all defines Define(name); // returns status associated with name Define(name, value); // add, remove or redefine a global
Parameters
Parameter | Type | Mandatory | Notes | API Version |
---|---|---|---|---|
name | String | The name of the define to check / add / remove / replace. If checking the state of a define, no other parameters are required. See also: Define.stateOf(), Define.has() and Define.hasNative(). If adding, removing or replacing a define, the value parameter must be also specified... | 1.0 | |
value | Function Null Undefined Boolean String Number | If specified, the name parameter must also be specified. A new global const called name will be defined (in the global scope) with a value of value, overriding any property of the same name on the global object:
Note that generic objects and arrays are not currently supported. These can be handled in future versions if there are sufficient valid feature requests. | 1.0 |
Return values
Different return values will be generated depending on the parameters supplied:
- No parameters – an object describing all current defines (keys) and their status (values)
- Name parameter – a constant describing the state of the define
- Name and value – define a new value for the named property
Value | Type | Notes | API Version |
---|---|---|---|
<error> | Error | An error occurred, most likely: | 1.0 |
<obj> | Object | If no parameters are specified, an object describing all current defines will be returned. The enumerable named own properties of the object are the names of things that have been defined, and their values are the statuses of those defines. Status values can be:
| 1.0 |
<state> | Constant | If both a name and value were specified, this will be the status of the named property after being defined. Status values can be those listed above. If only the name parameter was specified, this will be the status of the named property. Status values can be those listed above and, in addition, Define.MISSING which indicates the global property does not exist. | 1.0 |
Contents
Jump to:
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.has() — Check for presence of a global property...
- Define.RESERVED — A reserved keyword (a native that cannot be changed)...
- Define.stateOf() — Check state of a specific global property...
- Define.hasNative() — Check for presence of a native global property...
- Define.REMOVED — Indicates a native global was removed...
- Define.MISSING — Indicates a global is not present (missing).
- Define.NATIVE — Indicates a global was defined prior to including the Define API.
- Define.REPLACED — Indicates a global was replaced by a script using the Define API.
- Define.ADDED — Indicates a global was added by a script using the Define API.
- Define API Diagnostics — Diagnostic routines for Define API...
- Define Scripts — A library of ready made scripts for the Define API...