mirror of
https://github.com/DaanVandenBosch/phantasmal-world.git
synced 2025-04-07 16:58:26 +08:00
18 lines
513 B
TypeScript
18 lines
513 B
TypeScript
import { computed } from "mobx";
|
|
import { Server } from "../domain";
|
|
import { applicationStore } from "./ApplicationStore";
|
|
import { EnumMap } from "../enums";
|
|
|
|
export class ServerMap<V> extends EnumMap<Server, V> {
|
|
constructor(initialValue: (server: Server) => V) {
|
|
super(Server, initialValue)
|
|
}
|
|
|
|
/**
|
|
* @returns the value for the current server as set in {@link applicationStore}.
|
|
*/
|
|
@computed get current(): V {
|
|
return this.get(applicationStore.currentServer);
|
|
}
|
|
}
|