FORGE. Loader

new Loader(viewer)

This class have several methods to load assets and put them in cache.
Parameters:
Name Type Description
viewer FORGE.Viewer FORGE.Viewer reference.
Source:
To Do:
  • Clean callback and context from file like in jsonLoadComplete, this cause JS keep reference to viewer when destroyed.

Extends

Members

(readonly) alive :boolean

Get the alive flag value of the object.
Type:
  • boolean
Inherited From:
Source:

(readonly) className :string

Get the class name of the object.
Type:
  • string
Inherited From:
Source:

data :*

Get and set any custom data you want to associate to this object.
Type:
  • *
Inherited From:
Source:

debug :boolean

Get and set the debug flag.
Type:
  • boolean
Inherited From:
Source:

(readonly) onDestroy :FORGE.EventDispatcher

Get the onDestroy FORGE.EventDispatcher, this event is emitted at the end of the destroy sequence.
Type:
Inherited From:
Source:

(readonly) tags :Array

Get the tags associated to this object.
Type:
  • Array
Inherited From:
Source:

(readonly) uid :string

Get the uid of the object.
Type:
  • string
Inherited From:
Source:

warning :boolean

Get and set the warning flag.
Type:
  • boolean
Inherited From:
Source:

Methods

css(url, callback, context)

Load a CSS file.
Parameters:
Name Type Description
url string The url of the CSS file.
callback function The callback function called when file is completed.
context Object The callback context when file is completed.
Source:

destroy()

Destroy sequence.
Overrides:
Source:

image(key, url, callback, context)

Load an image file.
Parameters:
Name Type Description
key string The key for the image file.
url string The url of the image file.
callback function The callback function called when file is completed.
context Object The callback context when file is completed.
Source:

json(key, url, onCompleteCallback, onCompleteContext, onErrorCallbackopt, onErrorContextopt)

Load a json file.
Parameters:
Name Type Attributes Description
key string The key for the json file.
url string URL of the file.
onCompleteCallback function The callback function called when file is completed.
onCompleteContext Object The callback context when file is completed.
onErrorCallback function <optional>
The callback function called on file error.
onErrorContext Object <optional>
The callback context for file error.
Source:

log(value)

Basic log method, log a string in the console if debug is enabled.
Parameters:
Name Type Description
value * The value you want to log in the console.
Inherited From:
Source:

script(url, callback, context)

Load a script file.
Parameters:
Name Type Description
url string The url of the js file.
callback function The callback function called when file is completed.
context Object The callback context when file is completed.
Source:

sound(key, url, onCompleteCallback, onCompleteContext, forceAudioTagopt)

Load a sound file.
Parameters:
Name Type Attributes Description
key string The key for the sound file.
url string The url of the sound file.
onCompleteCallback function The callback function called when file is completed.
onCompleteContext Object The callback context when file is completed.
forceAudioTag boolean <optional>
Is audio tag is forced ?
Source:

warn(valuenullable)

Basic warn method, log a warn string in the console if warning is enabled.
Parameters:
Name Type Attributes Description
value string | Object <nullable>
The value you want to warn in the console.
Inherited From:
Source:

xml(key, url, onCompleteCallback, onCompleteContext, onErrorCallback, onErrorContext)

Load a xml file.
Parameters:
Name Type Description
key string The key for the xml file.
url string URL of the file.
onCompleteCallback function The callback function called when file is completed.
onCompleteContext Object The callback context when file is completed.
onErrorCallback function The callback function called on file error.
onErrorContext Object The callback context for file error.
Source:

FORGE. Loader

Members
Methods