inversify#postConstruct TypeScript Examples

The following examples show how to use inversify#postConstruct. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: locale-manager.ts    From malagu with MIT License 6 votes vote down vote up
@postConstruct()
    async init() {
        const locales = await this.get();
        const lang = localStorage.getItem(this.langStorageKey) || navigator.language;
        if (locales.length) {
            this.currentSubject.next(locales.find(l => l.lang === lang) || locales[0]);
        }

        this.currentSubject.subscribe(locale => {
            if (locale) {
                localStorage.setItem(this.langStorageKey, locale.lang);
            } else {
                localStorage.removeItem(this.langStorageKey);
            }
        });
    }
Example #2
Source File: theme-manager.ts    From malagu with MIT License 6 votes vote down vote up
@postConstruct()
    init() {
        const themeStr = localStorage.getItem(this.themeStorageKey);
        if (themeStr) {
            this.currentSubject.next(JSON.parse(themeStr));
        } else {
            if (this.themesForConfig) {
                this.currentSubject.next(this.themesForConfig[DEFAULT_THEME]);
            }
        }
        this.currentSubject.subscribe(theme => {
            if (theme) {
                localStorage.setItem(this.themeStorageKey, JSON.stringify(theme));
            } else {
                localStorage.removeItem(this.themeStorageKey);
            }
        });
    }
Example #3
Source File: ReplayWatcher.ts    From rewind with MIT License 5 votes vote down vote up
@postConstruct()
  initialize() {
    // Probably this should be somewhere else...
    this.newReplays$.subscribe((replayId) => {
      // TODO: if settings also true
      this.scenarioManager.loadReplay(replayId);
    });
  }
Example #4
Source File: AudioEngine.ts    From rewind with MIT License 5 votes vote down vote up
@postConstruct()
  postConstruct() {
    this.setupListeners(this.eventEmitter);
  }
Example #5
Source File: GameLoop.ts    From rewind with MIT License 5 votes vote down vote up
@postConstruct()
  initializeTicker() {
    this.ticker.add(this.tickHandler.bind(this));
  }
Example #6
Source File: expression-handler.ts    From malagu with MIT License 5 votes vote down vote up
@postConstruct()
    protected init() {

    }
Example #7
Source File: route-provider.ts    From malagu with MIT License 5 votes vote down vote up
@postConstruct()
    protected async init() {
        this.route = await this.routeBuilder.build();
        this.routeDeferred.resolve(this.route);
    }
Example #8
Source File: authentication-manager.ts    From malagu with MIT License 5 votes vote down vote up
@postConstruct()
    async init() {
        this.prioritized = Prioritizeable.prioritizeAllSync(this.authenticationProviders).map(c => c.value);
    }