forked from NativeScript/NativeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapplication-common.ts
More file actions
36 lines (25 loc) · 1.13 KB
/
application-common.ts
File metadata and controls
36 lines (25 loc) · 1.13 KB
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
require("globals");
import definition = require("application");
import fs = require("file-system");
import fileSystemAccess = require("file-system/file-system-access");
import styleScope = require("ui/styling/style-scope");
export var cssFile: string = "app.css"
export var resources: any = {};
export var onUncaughtError: (error: definition.NativeScriptError) => void = undefined;
export var onLaunch: (context: any) => any = undefined;
export var onSuspend: () => any = undefined;
export var onResume: () => any = undefined;
export var onExit: () => any = undefined;
export var onLowMemory: () => any = undefined;
export var android = undefined;
export var ios = undefined;
export function loadCss() {
if (definition.cssFile) {
var cssFileName = fs.path.join(fs.knownFolders.currentApp().path, definition.cssFile);
var applicationCss;
if (fs.File.exists(cssFileName)) {
new fileSystemAccess.FileSystemAccess().readText(cssFileName, r => { applicationCss = r; });
definition.cssSelectorsCache = styleScope.StyleScope.createSelectorsFromCss(applicationCss, cssFileName);
}
}
}