Class XHRLoader

JavaScript events for custom objects

Example

var Car = function () {

    EventDispatcher.call( this );
    this.start = function () {

        this.dispatchEvent( { type: 'start', message: 'vroom vroom!' } );

    };

};

var car = new Car();
car.addEventListener( 'start', function ( event ) {

    alert( event.message );

} );
car.start();
source

src/core/EventDispatcher.js

Hierarchy

Index

Constructor methods

Properties

Methods

Constructor methods

constructor(manager?: LoadingManager): XHRLoader

Parameters

Returns

XHRLoader

Properties

public cache: Cache

public crossOrigin: string

Methods

public addEventListener(type: string, listener: (event: any) => void)

Adds a listener to an event type.

Parameters

  • type: string

    The type of the listener that gets removed.

  • listener: (event: any) => void

    The listener function that gets removed.

public dispatchEvent(event: { type: string; target: any; })

Fire an event type.

Parameters

  • event: { type: string; target: any; }

public hasEventListener(type: string, listener: (event: any) => void)

Adds a listener to an event type.

Parameters

  • type: string

    The type of the listener that gets removed.

  • listener: (event: any) => void

    The listener function that gets removed.

public load(url: string, onLoad?: (responseText: string) => void, onProgress?: (event: any) => void, onError?: (event: any) => void)

Parameters

  • url: string
  • onLoad?: (responseText: string) => void optional
  • onProgress?: (event: any) => void optional
  • onError?: (event: any) => void optional

public removeEventListener(type: string, listener: (event: any) => void)

Removes a listener from an event type.

Parameters

  • type: string

    The type of the listener that gets removed.

  • listener: (event: any) => void

    The listener function that gets removed.

public setCrossOrigin(crossOrigin: string)

Parameters

  • crossOrigin: string