• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2* Copyright (c) 2024 Shenzhen Kaihong Digital Industry Development Co., Ltd.
3* Licensed under the Apache License, Version 2.0 (the "License");
4* you may not use this file except in compliance with the License.
5* You may obtain a copy of the License at
6*
7* http://www.apache.org/licenses/LICENSE-2.0
8*
9* Unless required by applicable law or agreed to in writing, software
10* distributed under the License is distributed on an "AS IS" BASIS,
11* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12* See the License for the specific language governing permissions and
13* limitations under the License.
14*/
15import * as vscode from 'vscode';
16import { IView } from "../view/iview";
17import { IModel } from "../model/imodel";
18import { Callback } from "../common/define";
19
20export abstract class IController {
21    abstract name: string;
22    abstract view: IView;
23    abstract model: IModel;
24    abstract uri: vscode.Uri;
25
26    private callbacks: Map<string, Callback> = new Map();
27
28    constructor() {
29    }
30
31    public abstract init(): void;
32
33    public abstract start(): void;
34
35    public abstract stop(): void;
36
37    public abstract pause(): void;
38
39    public abstract resume(): void;
40
41    public onEvent(event: string, cb: Callback): void {
42        this.callbacks.set(event, cb);
43    };
44    public offEvent(event: string): void {
45        this.callbacks.delete(event);
46    };
47}