-
-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathapp.js
More file actions
45 lines (36 loc) · 1.25 KB
/
app.js
File metadata and controls
45 lines (36 loc) · 1.25 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
37
38
39
40
41
42
43
44
45
/*
In NativeScript, the app.js file is the entry point to your application.
You can use this file to perform app-level initialization, but the primary
purpose of the file is to pass control to the app’s first module.
*/
import * as app from "tns-core-modules/application";
import "@nativescript/theme";
export function fonticon(value) {
if (value) {
const scope = app.getRootView()._styleScope;
if (!scope) {
return;
}
const icon = scope._selectors.class[value];
// eslint-disable-next-line no-unused-expressions
icon && icon
.flatMap((value) => value.sel.ruleset.declarations)
.reverse()
.some((dec) => {
if (dec.property === "content") {
const char = dec.value.replace(/^"|"$/g, "");
value = char.startsWith("\\") ?
String.fromCharCode(`0x${(char.match(/[a-f\d]{2,4}/i) || [])[0]}`) :
char;
return true;
}
});
}
return value;
}
app.setResources({ fonticon });
app.run({ moduleName: "app-root/app-root" });
/*
Do not place any code after the application has been started as it will not
be executed on iOS.
*/