API Docs for: 1.5.3
Show:

JsonLoader Class

The json file loader is used to load in JSON data and parse it When loaded this class will dispatch a 'loaded' event If loading fails this class will dispatch an 'error' event

Constructor

JsonLoader

(
  • url
  • crossorigin
)

Parameters:

  • url String

    The url of the JSON file

  • crossorigin Boolean

    Whether requests should be treated as crossorigin

Methods

addEventListener

(
  • type
  • listener
)

Adds a listener for a specific event

Parameters:

  • type String

    A string representing the event type to listen for.

  • listener Function

    The callback function that will be fired when the event occurs

dispatchEvent

(
  • event
)

Fires the event, ie pretends that the event has happened

Parameters:

  • event Event

    the event object

load

()

Loads the JSON data

onError

() private

Invoke when error occured

onJSONLoaded

() private

Invoke when JSON file is loaded

onLoaded

() private

Invoke when json file loaded

removeAllEventListeners

(
  • type
)

Removes all the listeners that were active for the specified event type

Parameters:

  • type String

    A string representing the event type which will have all its listeners removed

removeEventListener

(
  • type
  • listener
)

Removes the specified listener that was assigned to the specified event type

Parameters:

  • type String

    A string representing the event type which will have its listener removed

  • listener Function

    The callback function that was be fired when the event occured

Properties

baseUrl

String

[read-only] The base url of the bitmap font data

crossorigin

Boolean

Whether the requests should be treated as cross origin

listeners

Object

Holds all the listeners

loaded

Boolean

[read-only] Whether the data has loaded yet

url

String

The url of the bitmap font data