#

API Docs for: 1.6.0
Show: Inherited Protected Private Deprecated

# JsonLoader Class

Uses

- EventTarget

Defined in: `src/pixi/loaders/JsonLoader.js:5`
Module: PIXI

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`

)

Defined in `src/pixi/loaders/JsonLoader.js:5`

#### Parameters:

- `url` String

  The url of the JSON file

- `crossorigin` Boolean

  Whether requests should be treated as crossorigin

- Index
- Methods
- Properties

## Item Index

### Methods

- addEventListener
- dispatchEvent
- load
- onError
- onJSONLoaded
- onLoaded
- removeAllEventListeners
- removeEventListener

### Properties

- baseUrl
- crossorigin
- listeners
- loaded
- url

## Methods

### `addEventListener`

(

- `type`
- `listener`

)

Inherited from EventTarget: `src/pixi/utils/EventTarget.js:32`

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`

)

Inherited from EventTarget: `src/pixi/utils/EventTarget.js:55`

Fires the event, ie pretends that the event has happened

#### Parameters:

- `event` Event

  the event object

### `load`

()

Defined in `src/pixi/loaders/JsonLoader.js:58`

Loads the JSON data

### `onError`

() private

Defined in `src/pixi/loaders/JsonLoader.js:193`

Invoke when error occured

### `onJSONLoaded`

() private

Defined in `src/pixi/loaders/JsonLoader.js:108`

Invoke when JSON file is loaded

### `onLoaded`

() private

Defined in `src/pixi/loaders/JsonLoader.js:179`

Invoke when json file loaded

### `removeAllEventListeners`

(

- `type`

)

Inherited from EventTarget: `src/pixi/utils/EventTarget.js:101`

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`

)

Inherited from EventTarget: `src/pixi/utils/EventTarget.js:80`

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

Defined in `src/pixi/loaders/JsonLoader.js:35`

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

### `crossorigin`

Boolean

Defined in `src/pixi/loaders/JsonLoader.js:27`

Whether the requests should be treated as cross origin

### `listeners`

Object

Inherited from EventTarget: `src/pixi/utils/EventTarget.js:24`

Holds all the listeners

### `loaded`

Boolean

Defined in `src/pixi/loaders/JsonLoader.js:44`

[read-only] Whether the data has loaded yet

### `url`

String

Defined in `src/pixi/loaders/JsonLoader.js:19`

The url of the bitmap font data