MCPcopy Create free account
hub / github.com/NativeScript/NativeScript / createPage

Function createPage

apps/automated/src/pages/page8.ts:12–67  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10Trace.setCategories(Trace.categories.Style);
11
12export function createPage() {
13 function createTxt(text: string) {
14 var tv = new textView.TextView();
15 tv.text = text;
16
17 return tv;
18 }
19
20 var page = new pages.Page();
21 var scrollView = new scroll.ScrollView();
22
23 function performGet() {
24 console.log('Getting CSS');
25 http.getString('http://192.168.54.36:8080/test.css').then(
26 function (r) {
27 console.log('Applying CSS');
28 page.css = r;
29 timer.setTimeout(performGet, 1000);
30 },
31 function (e) {
32 console.log('Error: ' + e);
33 timer.setTimeout(performGet, 1000);
34 }
35 );
36 }
37
38 var stack = new stacks.StackLayout();
39 scrollView.content = stack;
40
41 var counter = 0;
42 var btn = new btns.Button();
43 btn.text = 'tap';
44 btn.on(btns.Button.tapEvent, function () {
45 btn.text = 'hi: ' + counter++;
46 });
47 btn.isEnabled = false;
48
49 stack.addChild(btn);
50 stack.addChild(createTxt('this is label'));
51
52 var info = new btns.Button();
53 info.text = 'info';
54 info.className = 'info';
55 info.on(btns.Button.tapEvent, function () {
56 info.text = 'hi: ' + counter++;
57 btn.isEnabled = true;
58 });
59 stack.addChild(info);
60
61 stack.addChild(createTxt('this is another label'));
62
63 page.content = scrollView;
64 timer.setTimeout(performGet, 2000);
65
66 return page;
67}
68
69//export var Page = page;

Callers

nothing calls this directly

Calls 3

createTxtFunction · 0.85
onMethod · 0.65
addChildMethod · 0.45

Tested by

no test coverage detected