
import ViewManagerService from "./ViewManagerService";

const REFRESH_INTERVAL = 3000;

export default class StyleManager {

    private _viewManager: ViewManagerService;

    private _intervalHandler;

    constructor() {
    }

    linkToViewManager(viewManager : ViewManagerService) {
        this._viewManager = viewManager;
    }

    explorationStarted(): Promise<void> {
        return this._viewManager.refresh();
            // .then(() => {
            //     this._intervalHandler = setInterval(this.refresh.bind(this), REFRESH_INTERVAL);
            //     return this.refresh();
            // })
    }
    
    explorationStopped(): void {
        clearInterval(this._intervalHandler);
        this._viewManager.refresh();
    }

    refresh(): Promise<void> {
        return this._viewManager.refresh();
    }

}
