ConsoleShortcuts: add Stores map with all stores

This commit is contained in:
Vendicated 2024-06-14 22:56:21 +02:00
parent 2f4e346e26
commit ca810250d1
No known key found for this signature in database
GPG key ID: D66986BAF75ECF18
2 changed files with 11 additions and 1 deletions

View file

@ -141,7 +141,15 @@ function makeShortcuts() {
guildId: { getter: () => Common.SelectedGuildStore.getGuildId(), preload: false }, guildId: { getter: () => Common.SelectedGuildStore.getGuildId(), preload: false },
me: { getter: () => Common.UserStore.getCurrentUser(), preload: false }, me: { getter: () => Common.UserStore.getCurrentUser(), preload: false },
meId: { getter: () => Common.UserStore.getCurrentUser().id, preload: false }, meId: { getter: () => Common.UserStore.getCurrentUser().id, preload: false },
messages: { getter: () => Common.MessageStore.getMessages(Common.SelectedChannelStore.getChannelId()), preload: false } messages: { getter: () => Common.MessageStore.getMessages(Common.SelectedChannelStore.getChannelId()), preload: false },
Stores: {
getter: () => Object.fromEntries(
Common.Flux.Store.getAll()
.map(store => [store.getName(), store] as const)
.filter(([name]) => name.length > 1)
)
}
}; };
} }

View file

@ -39,6 +39,8 @@ export class FluxStore {
syncWith: GenericFunction; syncWith: GenericFunction;
waitFor: GenericFunction; waitFor: GenericFunction;
__getLocalVars(): Record<string, any>; __getLocalVars(): Record<string, any>;
static getAll(): FluxStore[];
} }
export class FluxEmitter { export class FluxEmitter {