mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
25 lines
531 B
JavaScript
25 lines
531 B
JavaScript
|
import { Signal } from "./signal";
|
||
|
|
||
|
export class InputReceiver {
|
||
|
constructor(context = "unknown") {
|
||
|
this.context = context;
|
||
|
|
||
|
this.backButton = new Signal();
|
||
|
|
||
|
this.keydown = new Signal();
|
||
|
this.keyup = new Signal();
|
||
|
this.pageBlur = new Signal();
|
||
|
|
||
|
// Dispatched on destroy
|
||
|
this.destroyed = new Signal();
|
||
|
}
|
||
|
|
||
|
cleanup() {
|
||
|
this.backButton.removeAll();
|
||
|
this.keydown.removeAll();
|
||
|
this.keyup.removeAll();
|
||
|
|
||
|
this.destroyed.dispatch();
|
||
|
}
|
||
|
}
|