Skip to content

Commit

Permalink
Added app
Browse files Browse the repository at this point in the history
  • Loading branch information
ackava committed Jun 27, 2023
1 parent 4df2fdc commit 0c00edd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/core/Command.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { App } from "../App";
import type { AtomControl } from "../web/controls/AtomControl";
import EventScope from "./EventScope";
import Route from "./Route";
import { CancelToken, type IDisposable } from "./types";
Expand Down Expand Up @@ -304,12 +305,15 @@ export default class Command<T = any, TR = any> {

export class Commands {

public static install(app: { app: any, registerDisposable(d: IDisposable): IDisposable }) {
protected static app: App;

public static install(control: AtomControl) {
this.app = control.app;
for (const key in this) {
if (Object.prototype.hasOwnProperty.call(this, key)) {
const element = this[key];
if (element instanceof Command) {
element.listen(app);
element.listen(control);
}
}
}
Expand Down

0 comments on commit 0c00edd

Please sign in to comment.