TypeScript Definitions. PluginManager.add is now generic. Whatever class you pass in will come back out as an instance. Example var myAStar = this.game.plugins.add(Phaser.Plugin.AStar);

This commit is contained in:
Clark Stevenson 2015-10-06 15:34:26 +01:00
parent 41ff44229a
commit 13d4dfd9e3

View file

@ -3575,6 +3575,10 @@ declare module Phaser {
}
}
interface PluginConstructorOf<T> {
new (...parameters: any[]): T;
}
class PluginManager implements IStateCycle {
constructor(game: Phaser.Game);
@ -3582,7 +3586,7 @@ declare module Phaser {
game: Phaser.Game;
plugins: Phaser.Plugin[];
add(plugin: Phaser.Plugin | typeof Phaser.Plugin, ...parameter: any[]): Phaser.Plugin;
add<T extends Phaser.Plugin>(plugin: PluginConstructorOf<T>, ...parameters: any[]): T;
destroy(): void;
postRender(): void;
postUpdate(): void;