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

Define.NATIVE

Indicates a global was defined prior to including the Define API.

 

Notes

A define with state Define.NATIVE is usually defined by the Javascript API, but can sometimes also be created by other libraries that were included prior to Define API.

Natives are properties of the global object and can usually be overridden by Define() unless there is a global scope constant of the same name already defined.

Examples

Checking a specific state
// always use strict equality checks
if (Define.stateOf("chat") === Define.NATIVE) {
	// native chat function exists and not overridden
}
Checking if native exists
// you can check if a native exists (including overridden natives)
if (Define.hasNative("chat")) {
	// native JS API chat() function exists
    // it might have been overridden by something
    if (Define.stateOf("chat") === Define.REPLACED) {
		// it's been overridden
		// you can get the original function...
		native.chat; // original chat() function
	}
} 
Availability STABLE

Requires:

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 API DiagnosticsDiagnostic routines for Define API...
  • Define ScriptsA library of ready made scripts for the Define API...