-
Notifications
You must be signed in to change notification settings - Fork 540
/
Copy pathglobal.d.ts
58 lines (50 loc) · 1.7 KB
/
global.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/**
* This file is used for *monkey-patching* existing declarations. Don't use it to declare global variables.
*/
import { Logger } from "./api/common/Logger"
import Mithril from "mithril"
import { LanguageViewModel } from "./misc/LanguageViewModel"
import { ClientDetector } from "./misc/ClientDetector"
import { RootView } from "./RootView"
import { ICommonLocator } from "./api/main/CommonLocator"
import { WhitelabelCustomizations } from "./misc/WhitelabelCustomizations"
import { WorkerLocatorType } from "./api/worker/WorkerLocator"
import { TopLevelView } from "./TopLevelView.js"
interface NativeApp {
// In desktop, we can pass whole objects
// In app, we can only pass strings
invoke(message: any)
attach(handler: (JsMessage) => unknown)
getPathForFile(file: File): string
startWebMessageChannel() // Available in android
}
type Tutao = {
currentView: TopLevelView | null
m: typeof Mithril
lang: LanguageViewModel
client: ClientDetector
root: RootView
locator: ICommonLocator | null
nativeApp? // Will either be IosNativeTransport or null
appState?
}
// Monkey-patch Window.
// see https://www.typescriptlang.org/docs/handbook/declaration-files/templates/global-modifying-module-d-ts.html
declare global {
interface Window {
tutao: Tutao
logger: Logger
/** Set by the server for whitelabel domains. */
whitelabelCustomizations: WhitelabelCustomizations | undefined
/** The NativeApp for use in the main client */
nativeApp: NativeApp
/**
* The NativeApp for use in web dialogs.
* It's existence can be used to determine whether or not we are inside a web dialog
* */
nativeAppWebDialog: NativeApp | undefined
}
interface WorkerGlobalScope {
locator: WorkerLocatorType
}
}