mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
definitions fixed
This commit is contained in:
@@ -1,6 +1,15 @@
|
||||
require("globals");
|
||||
import definition = require("application");
|
||||
import cssParser = require("js-libs/reworkcss");
|
||||
import fs = require("file-system");
|
||||
import fileSystemAccess = require("file-system/file-system-access");
|
||||
import styleScope = require("ui/styling/style-scope");
|
||||
|
||||
export var onLaunch: () => any = undefined;
|
||||
export var cssFile: string = "app/app.css"
|
||||
|
||||
export var onUncaughtError: (error: definition.NativeScriptError) => void = undefined;
|
||||
|
||||
export var onLaunch: (context: any) => any = undefined;
|
||||
|
||||
export var onSuspend: () => any = undefined;
|
||||
|
||||
@@ -12,4 +21,17 @@ export var onLowMemory: () => any = undefined;
|
||||
|
||||
export var android = undefined;
|
||||
|
||||
export var ios = 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)) {
|
||||
// Read the CSS file.
|
||||
new fileSystemAccess.FileSystemAccess().readText(cssFileName, r => { applicationCss = r; });
|
||||
var applicationCssSyntaxTree = cssParser.parse(applicationCss, undefined);
|
||||
definition.cssSelectorsCache = styleScope.StyleScope.createSelectorsFromSyntaxTree(applicationCssSyntaxTree);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user