forked from profectus/Profectus
Add onLoad event
This commit is contained in:
parent
013092fff3
commit
fe865bff9d
2 changed files with 8 additions and 0 deletions
|
@ -45,6 +45,11 @@ export interface GlobalEvents {
|
|||
* @param vue The Vue App being constructed.
|
||||
*/
|
||||
setupVue: (vue: App) => void;
|
||||
/**
|
||||
* Sent whenever a save has finished loading.
|
||||
* Happens when the page is opened and upon switching saves in the saves manager.
|
||||
*/
|
||||
onLoad: VoidFunction;
|
||||
}
|
||||
|
||||
/** A global event bus for hooking into {@link GlobalEvents}. */
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import projInfo from "data/projInfo.json";
|
||||
import { globalBus } from "game/events";
|
||||
import type { Player, PlayerData } from "game/player";
|
||||
import player, { stringifySave } from "game/player";
|
||||
import settings, { loadSettings } from "game/settings";
|
||||
|
@ -112,6 +113,8 @@ export async function loadSave(playerObj: Partial<PlayerData>): Promise<void> {
|
|||
|
||||
Object.assign(player, playerObj);
|
||||
settings.active = player.id;
|
||||
|
||||
globalBus.emit("onLoad");
|
||||
}
|
||||
|
||||
setInterval(() => {
|
||||
|
|
Loading…
Reference in a new issue