Constructor
# new device/Environment()
Environment module.
This class is designed as a singleton, you should always use the singleton to get the instance.
- device/Environment#SYSTEM.event:LOAD
- device/Environment#SYSTEM.event:UNLOAD
- device/Environment#SYSTEM.event:KEYDOWN
- device/Environment#SYSTEM.event:KEYPRESS
- device/Environment#SYSTEM.event:KEYUP
- device/Environment#SYSTEM.event:MOUSEON
- device/Environment#SYSTEM.event:MOUSEOFF
- device/Environment#SYSTEM.event:SUSPEND
- device/Environment#SYSTEM.event:RESUME
- device/Environment#SYSTEM.event:RESIZE
- device/Environment#SYSTEM.event:NETWORK_STATUS_CHANGED
- device/Environment#SYSTEM.event:ERROR
- device/Environment#MEDIA.event:BUFFERING
- device/Environment#MEDIA.event:FINISHED
- device/Environment#MEDIA.event:STATE_CHANGED
- device/Environment#MEDIA.event:TIME_UPDATE
- device/Environment#MEDIA.event:ERROR
- device/Environment#MEDIA.event:SPEED
- device/Environment#DEVICE.event:ONDETECT
- device/Environment#DEVICE.event:ONLOAD
- device/Environment#DEVICE.event:ONUNLOAD
- device/Environment#DEVICE.event:ERROR
Example
sEnv = Environment.singleton();
sEnv.dispatchEvent(sEnv.DEVICE.ONLOAD, data);
Extends
Methods
# addEventListener(type, handler, onceopt) → {ax/EventDispatcher}
Registers an event listener for a certain type.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
type |
String
|
event type |
|
handler |
function
|
event listener function |
|
once |
Boolean
|
<optional> |
set to true if listener will be called only once |
- Inherited From:
current event dispatcher, for easier chaining
ax/EventDispatcher
# dispatchEvent(type, data, handleError) → {Boolean}
Dispatches an event with additional data.
Parameters:
Name | Type | Description |
---|---|---|
type |
String
|
event type to dispatch |
data |
Object
|
the event data object |
handleError |
Boolean
|
catch the errors on thrown in listener and handle gracefully. Default is false. |
- Inherited From:
result dispatch success for true
Boolean
# removeAllListeners() → {ax/EventDispatcher}
Removes all event listeners.
- Inherited From:
- See:
-
- ax/EventDispatcher#removeEventListener
current event dispatcher, for easier chaining
ax/EventDispatcher
# removeEventListener(type, handleropt) → {ax/EventDispatcher}
Removes one or more event listeners.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
type |
xdk-ax/evt
|
String
|
Event type |
|
handler |
function
|
<optional> |
event listener function. If not provided, all listeners will be removed for the specific type. |
- Inherited From:
current event dispatcher, for easier chaining
ax/EventDispatcher