1.0.0
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
export class Terminal {
|
||||
constructor() {
|
||||
this._refreshFunctions = [];
|
||||
this._initFunctions = [];
|
||||
this.initialized = false;
|
||||
}
|
||||
|
||||
registerRefresh(func) {
|
||||
this._refreshFunctions.push(func);
|
||||
}
|
||||
|
||||
registerInitFunc(func) {
|
||||
this._initFunctions.push(func);
|
||||
}
|
||||
|
||||
refresh() {
|
||||
if (!this.initialized) {
|
||||
this._initFunctions.forEach(func => func());
|
||||
this.initialized = true;
|
||||
}
|
||||
this._refreshFunctions.forEach(func => func());
|
||||
}
|
||||
}
|
||||
|
||||
export var terminal = new Terminal();
|
||||
window.terminal = terminal;
|
||||
Reference in New Issue
Block a user