2020-10-09 19:35:46 +02:00
|
|
|
import { ViewHandle } from './utils/createViewHandle';
|
|
|
|
|
|
|
|
export default class ViewController {
|
|
|
|
|
2020-11-12 21:13:28 +02:00
|
|
|
private handle_: ViewHandle;
|
|
|
|
private pluginId_: string;
|
|
|
|
private store_: any;
|
2020-10-09 19:35:46 +02:00
|
|
|
|
2020-11-12 21:13:28 +02:00
|
|
|
constructor(handle: ViewHandle, pluginId: string, store: any) {
|
2020-10-09 19:35:46 +02:00
|
|
|
this.handle_ = handle;
|
|
|
|
this.pluginId_ = pluginId;
|
|
|
|
this.store_ = store;
|
|
|
|
}
|
|
|
|
|
2020-11-12 21:13:28 +02:00
|
|
|
protected get storeView(): any {
|
2020-10-09 19:35:46 +02:00
|
|
|
return this.store_.pluginService.plugins[this.pluginId_].views[this.handle];
|
|
|
|
}
|
|
|
|
|
2020-11-12 21:13:28 +02:00
|
|
|
protected get store(): any {
|
2020-10-09 19:35:46 +02:00
|
|
|
return this.store_;
|
|
|
|
}
|
|
|
|
|
2020-11-12 21:13:28 +02:00
|
|
|
public get pluginId(): string {
|
2020-10-09 19:35:46 +02:00
|
|
|
return this.pluginId_;
|
|
|
|
}
|
|
|
|
|
2020-11-12 21:13:28 +02:00
|
|
|
public get key(): string {
|
2020-10-09 19:35:46 +02:00
|
|
|
return this.handle_;
|
|
|
|
}
|
|
|
|
|
2020-11-12 21:13:28 +02:00
|
|
|
public get handle(): ViewHandle {
|
2020-10-09 19:35:46 +02:00
|
|
|
return this.handle_;
|
|
|
|
}
|
|
|
|
|
2020-11-12 21:13:28 +02:00
|
|
|
public get type(): string {
|
2020-10-09 19:35:46 +02:00
|
|
|
throw new Error('Must be overriden');
|
|
|
|
}
|
|
|
|
|
2020-11-12 21:13:28 +02:00
|
|
|
public emitMessage(event: any) {
|
2020-10-09 19:35:46 +02:00
|
|
|
console.info('Calling ViewController.emitMessage - but not implemented', event);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|