forked from NativeScript/NativeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpage7.ts
More file actions
59 lines (50 loc) · 1.79 KB
/
page7.ts
File metadata and controls
59 lines (50 loc) · 1.79 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import pages = require("ui/page");
import buttons = require("ui/button");
export function createPage() {
var page = new pages.Page();
var btn = new buttons.Button();
btn.width = 200;
btn.height = 60;
btn.text = "test";
var vAligns = ["stretch", "top", "center", "bottom"];
//var hAligns = ["stretch", "left", "center", "right"];
var count = 0;
btn.on(buttons.Button.tapEvent, function () {
//page.css = "button { vertical-align:" + vAligns[(count++) % 4] + " }";
btn.verticalAlignment = vAligns[(count++) % 4];
})
//export function performanceTest() {
// var testBtn = new buttons.Button();
// var i = 0;
// var tmp;
// var start;
// var end;
// start = new Date().getTime();
// for (i = 0; i < 1000000; i++) {
// tmp = testBtn.verticalAlignment;
// }
// end = new Date().getTime();
// console.log("GET from STYLE time: " + (end - start));
// start = new Date().getTime();
// for (i = 0; i < 1000000; i++) {
// tmp = testBtn.horizontalAlignment;
// }
// end = new Date().getTime();
// console.log("GET from LayoutInfo time: " + (end - start));
// start = new Date().getTime();
// for (i = 0; i < 1000000; i++) {
// testBtn.verticalAlignment = vAligns[i % 4];
// }
// end = new Date().getTime();
// console.log("SET to STYLE time: " + (end - start));
// start = new Date().getTime();
// for (i = 0; i < 1000000; i++) {
// testBtn.horizontalAlignment = hAligns[i % 4];
// }
// end = new Date().getTime();
// console.log("SET from LayoutInfo time: " + (end - start));
// }
page.content = btn;
return page;
}
//export var Page = page;