export class BaseView extends Jade.UI.Control {
    constructor(options) {
        super(options);
        this.m_source = options.source;
        this.state.unset("source");
    }
    get source() {
        return this.m_source;
    }
    set source(value) {
        this.m_source = value;
    }
    get globals() {
        return this.source.root.context.globals;
    }
    get subscribers() {
        this.ensureSubscribers();
        return this.m_subscribers;
    }
    onDestroy(e) {
        super.onDestroy(e);
        this.subscribers.forEach(subscriber => {
            subscriber.unsubscribe();
        });
    }
    ensureSubscribers() {
        if (this.m_subscribers == null) {
            this.m_subscribers = [];
        }
    }
}
