2021-12-13 11:21:18 +01:00
|
|
|
// (C) Copyright 2015 Moodle Pty Ltd.
|
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
|
2022-02-10 10:43:06 +01:00
|
|
|
import { CoreConfig, CoreConfigProvider } from '@services/config';
|
2022-02-17 13:54:54 +01:00
|
|
|
import { CoreDB, CoreDbProvider } from '@services/db';
|
2022-02-21 12:33:17 +01:00
|
|
|
import { CoreCustomURLSchemes, CoreCustomURLSchemesProvider } from '@services/urlschemes';
|
2021-12-13 11:21:18 +01:00
|
|
|
import { CoreConstants } from '../constants';
|
|
|
|
|
|
|
|
type DevelopmentWindow = Window & {
|
2022-02-10 10:43:06 +01:00
|
|
|
configProvider?: CoreConfigProvider;
|
2022-02-17 13:54:54 +01:00
|
|
|
dbProvider?: CoreDbProvider;
|
2022-02-21 12:33:17 +01:00
|
|
|
urlSchemes?: CoreCustomURLSchemesProvider;
|
2021-12-13 11:21:18 +01:00
|
|
|
};
|
|
|
|
|
2022-02-10 10:43:06 +01:00
|
|
|
function initializeDevelopmentWindow(window: DevelopmentWindow) {
|
|
|
|
window.configProvider = CoreConfig.instance;
|
2022-02-17 13:54:54 +01:00
|
|
|
window.dbProvider = CoreDB.instance;
|
2022-02-21 12:33:17 +01:00
|
|
|
window.urlSchemes = CoreCustomURLSchemes.instance;
|
2021-12-13 11:21:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export default function(): void {
|
2022-02-10 10:43:06 +01:00
|
|
|
if (!CoreConstants.enableDevTools()) {
|
2021-12-13 11:21:18 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-02-10 10:43:06 +01:00
|
|
|
initializeDevelopmentWindow(window);
|
2021-12-13 11:21:18 +01:00
|
|
|
}
|