Skip to content

Commit

Permalink
Up commands
Browse files Browse the repository at this point in the history
  • Loading branch information
artf committed Mar 22, 2024
1 parent e06e02c commit ecd4a3e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/asset_manager/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,8 @@ export default class AssetManager extends ItemManagerModule<AssetManagerConfig,
onLoad() {
this.getAll().reset(this.config.assets);
const { em, events } = this;
em.on(`run:${assetCmd}`, () => this.__propEv(events.open));
em.on(`stop:${assetCmd}`, () => this.__propEv(events.close));
em.Commands.__onRun(assetCmd, () => this.__propEv(events.open));
em.Commands.__onStop(assetCmd, () => this.__propEv(events.close));
}

postRender(editorView: any) {
Expand Down
10 changes: 10 additions & 0 deletions src/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,16 @@ export default class CommandsModule extends Module<CommandsConfig & { pStylePref
return new cmd(this.config);
}

__onRun(id: string, clb: () => void) {
const { em, events } = this;
em.on(`${events.runCommand}${id}`, clb);
}

__onStop(id: string, clb: () => void) {
const { em, events } = this;
em.on(`${events.stopCommand}${id}`, clb);
}

destroy() {
this.defaultCommands = {};
this.commands = {};
Expand Down

0 comments on commit ecd4a3e

Please sign in to comment.