1// Copyright (C) 2023 The Android Open Source Project 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15import {produce} from 'immer'; 16import m from 'mithril'; 17 18import {Actions} from '../common/actions'; 19import {pluginManager} from '../common/plugins'; 20import {getSchema} from '../common/schema'; 21import {raf} from '../core/raf_scheduler'; 22 23import {globals} from './globals'; 24 25declare global { 26 interface Window { 27 m: typeof m; 28 getSchema: typeof getSchema; 29 globals: typeof globals; 30 Actions: typeof Actions; 31 produce: typeof produce; 32 pluginManager: typeof pluginManager; 33 raf: typeof raf; 34 } 35} 36 37export function registerDebugGlobals() { 38 window.getSchema = getSchema; 39 window.m = m; 40 window.globals = globals; 41 window.Actions = Actions; 42 window.produce = produce; 43 window.pluginManager = pluginManager; 44 window.raf = raf; 45} 46