Class MaterialLoader

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

Methods

Constructor methods

constructor(manager?: LoadingManager): MaterialLoader

Parameters

Returns

MaterialLoader

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: (material: THREE.Material) => void)

Parameters

  • url: string
  • onLoad: (material: THREE.Material) => void

public parse(json: any): Material

Parameters

  • json: any

Returns

Material

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