Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Excerpt |
---|
Add, remove or redefine a property on the global scope, overriding any native property of the same name on the global object... |
Syntax
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
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 or and, in addition, Define.MISSING which indicates the global property does not exist. | 1.0 |
Div | ||||||
---|---|---|---|---|---|---|
| ||||||
Availability
Requires:
|
Div | ||||
---|---|---|---|---|
| ||||
ContentsJump to:
|
Div | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
Define APITopics:
|