@finos/legend-application
Version:
Legend application core
39 lines • 1.86 kB
JavaScript
/**
* Copyright (c) 2020-present, Goldman Sachs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { BrowserNavigator } from '../navigation/BrowserNavigator.js';
import { ApplicationPlatform } from './ApplicationPlatform.js';
import { LEGEND_APPLICATION_PARAM_TOKEN } from '../../__lib__/LegendApplicationNavigation.js';
export class BrowserPlatform extends ApplicationPlatform {
navigator;
constructor(applicationStore, config) {
super(applicationStore);
this.navigator = new BrowserNavigator(config.navigate, config.baseUrl);
}
getNavigator() {
return this.navigator;
}
async initialize() {
// set initial color theme
// NOTE: we allow this to avoid the flash of default color theme
// when loading the page from another page/ when using the application in an iframe
const initialColorTheme = this.applicationStore.navigationService.navigator.getCurrentLocationParameterValue(LEGEND_APPLICATION_PARAM_TOKEN.INITIAL_COLOR_THEME);
if (initialColorTheme) {
this.applicationStore.layoutService.setColorTheme(initialColorTheme);
this.applicationStore.navigationService.navigator.INTERNAL__internalizeTransientParameter(LEGEND_APPLICATION_PARAM_TOKEN.INITIAL_COLOR_THEME);
}
}
}
//# sourceMappingURL=BrowserPlatform.js.map