@thejsngin/jsngin / Exports
@thejsngin/jsngin
Table of contents
Interfaces
Type Aliases
- BaseEnv
- Callback
- CustomEvent
- DisposeEventParameters
- DisposeEventReturnValue
- EventLevel
- InitEventParameters
- InitEventReturnValue
- LoadCompleteEventParameters
- LoadCompleteEventReturnValue
- LoadErrorEventParameters
- LoadErrorEventReturnValue
- LoadEventParameters
- LoadEventReturnValue
- LoadFailedEventParameters
- LoadFailedEventReturnValue
- LoadProgressEventParameters
- LoadProgressEventReturnValue
- ResourceEventParameters
- ResourceEventReturnValue
Variables
- disposeEvent
- initEvent
- loadCompleteEvent
- loadErrorEvent
- loadEvent
- loadFailedEvent
- loadProgressEvent
- resourceEvent
Functions
Events
- DisposeEvent
- InitEvent
- LoadCompleteEvent
- LoadErrorEvent
- LoadEvent
- LoadFailedEvent
- LoadProgressEvent
- ResourceEvent
Type Aliases
BaseEnv
Ƭ BaseEnv: Object
Type declaration
Name | Type |
---|---|
domElement? | HTMLElement |
gameObjectUserData? | any |
loadGameObjectUserData? | any |
Defined in
Callback
Ƭ Callback<eventType
>: (gameInstance
: any
, gameObjectInstance
: any
, componentHelpers
: any
, ...data
: eventType
["data"
]) => eventType
["returnVal"
]
Type parameters
Name | Type |
---|---|
eventType | extends CustomEvent |
Type declaration
▸ (gameInstance
, gameObjectInstance
, componentHelpers
, ...data
): eventType
["returnVal"
]
Parameters
Name | Type |
---|---|
gameInstance | any |
gameObjectInstance | any |
componentHelpers | any |
...data | eventType ["data" ] |
Returns
eventType
["returnVal"
]
Defined in
CustomEvent
Ƭ CustomEvent: Object
Type declaration
Name | Type |
---|---|
data | any [] |
eventLevel | EventLevel |
name | string |
returnVal | any |
waitForCompletion | boolean |
Defined in
DisposeEventParameters
Ƭ DisposeEventParameters: []
Defined in
DisposeEventReturnValue
Ƭ DisposeEventReturnValue: Promise
<void
>
Defined in
EventLevel
Ƭ EventLevel: ("game"
| "gameObject"
| "anonymous"
)[]
Defined in
InitEventParameters
Ƭ InitEventParameters: []
Defined in
InitEventReturnValue
Ƭ InitEventReturnValue: any
Defined in
LoadCompleteEventParameters
Ƭ LoadCompleteEventParameters: []
Defined in
LoadCompleteEventReturnValue
Ƭ LoadCompleteEventReturnValue: any
Defined in
LoadErrorEventParameters
Ƭ LoadErrorEventParameters: Object
Type declaration
Name | Type |
---|---|
exception | Error |
failLoad | () => void |
failed | number |
settled | number |
total | number |
Defined in
LoadErrorEventReturnValue
Ƭ LoadErrorEventReturnValue: any
Defined in
LoadEventParameters
Ƭ LoadEventParameters: Object
Type declaration
Name | Type |
---|---|
addToLoadTracking | (promise : Promise <any >, weight? : number ) => void |
Defined in
LoadEventReturnValue
Ƭ LoadEventReturnValue: any
Defined in
LoadFailedEventParameters
Ƭ LoadFailedEventParameters: []
Defined in
LoadFailedEventReturnValue
Ƭ LoadFailedEventReturnValue: any
Defined in
LoadProgressEventParameters
Ƭ LoadProgressEventParameters: Object
Type declaration
Name | Type |
---|---|
failLoad | () => void |
failed | number |
settled | number |
total | number |
Defined in
LoadProgressEventReturnValue
Ƭ LoadProgressEventReturnValue: any
Defined in
ResourceEventParameters
Ƭ ResourceEventParameters: []
Defined in
ResourceEventReturnValue
Ƭ ResourceEventReturnValue: Promise
<any
& { resourceName
: string
}> | any
& { resourceName
: string
}
Defined in
Variables
disposeEvent
• Const
disposeEvent: "dispose"
Defined in
initEvent
• Const
initEvent: "init"
Defined in
loadCompleteEvent
• Const
loadCompleteEvent: "loadComplete"
Defined in
loadErrorEvent
• Const
loadErrorEvent: "loadError"
Defined in
loadEvent
• Const
loadEvent: "load"
Defined in
loadFailedEvent
• Const
loadFailedEvent: "loadFailed"
Defined in
loadProgressEvent
• Const
loadProgressEvent: "loadProgress"
Defined in
resourceEvent
• Const
resourceEvent: "resource"
Defined in
Functions
game
▸ game(gameObject
, env
, loadGameObject?
): Promise
<GameInstance
>
Creates a gameInstance
and then returns it.
Parameters
Name | Type |
---|---|
gameObject | GameObject |
env | { [key: string] : any ; } & BaseEnv |
loadGameObject? | GameObject |
Returns
Promise
<GameInstance
>
Defined in
Events
DisposeEvent
Ƭ DisposeEvent: Object
Fired when the gameObject/Component is deleted.
Type declaration
Name | Type |
---|---|
data | DisposeEventParameters |
eventLevel | ["gameObject" , "anonymous" ] |
name | "dispose" |
returnVal | DisposeEventReturnValue |
waitForCompletion | true |
Defined in
InitEvent
Ƭ InitEvent: Object
AutoFired after LoadCompleteEvent
. The order of this event for the gameObject tree is post order.
Type declaration
Name | Type |
---|---|
data | InitEventParameters |
eventLevel | ["game" , "gameObject" ] |
name | "init" |
returnVal | InitEventReturnValue |
waitForCompletion | true |
Defined in
LoadCompleteEvent
Ƭ LoadCompleteEvent: Object
AutoFired when all the tracked promises are setteled.
Type declaration
Name | Type |
---|---|
data | LoadCompleteEventParameters |
eventLevel | ["game" ] |
name | "loadComplete" |
returnVal | LoadCompleteEventReturnValue |
waitForCompletion | true |
Defined in
LoadErrorEvent
Ƭ LoadErrorEvent: Object
Fired during load, everytime a tracked promise is rejected.
Type declaration
Name | Type |
---|---|
data | LoadErrorEventParameters |
eventLevel | ["game" ] |
name | "loadError" |
returnVal | LoadErrorEventReturnValue |
waitForCompletion | false |
Defined in
LoadEvent
Ƭ LoadEvent: Object
Autofired before initializing the world and after the resource event.
Type declaration
Name | Type |
---|---|
data | LoadEventParameters |
eventLevel | ["game" | "gameObject" ] |
name | "load" |
returnVal | LoadEventReturnValue |
waitForCompletion | true |
Defined in
LoadFailedEvent
Ƭ LoadFailedEvent: Object
AutoFired when the failLoad
function is called in either loadErrorEvent
or LoadProgressEvent
. Loading process is halted and the gameObjectInstance being created is disposed inidiately after this.
Type declaration
Name | Type |
---|---|
data | LoadFailedEventParameters |
eventLevel | ["game" ] |
name | "loadFailed" |
returnVal | LoadFailedEventReturnValue |
waitForCompletion | false |
Defined in
LoadProgressEvent
Ƭ LoadProgressEvent: Object
Fired during load, everytime a tracked promise is resolved. This Event can be used to track load progress.
Type declaration
Name | Type |
---|---|
data | LoadProgressEventParameters |
eventLevel | ["game" ] |
name | "loadProgress" |
returnVal | LoadProgressEventReturnValue |
waitForCompletion | false |
Defined in
ResourceEvent
Ƭ ResourceEvent: Object
First event to be fired. The returned value or resolved value of the returned promise will be used as the the resource for this component. This can later be accessed at gameObjecInstance.components[componentName].
Type declaration
Name | Type |
---|---|
data | [] |
eventLevel | ["anonymous" ] |
name | "resource" |
returnVal | ResourceEventReturnValue |
waitForCompletion | false |