-
Notifications
You must be signed in to change notification settings - Fork 0
/
hello.js
42 lines (36 loc) · 1.06 KB
/
hello.js
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
var node = require('tabris-js-node');
var Firebase = require('firebase');
var shelvableDb = new Firebase('http://booklist1.firebaseio.com/');
items = [];
shelvableDb.child('bookCache').child('0bMLHltYucsC').once('value', function(data) {
for (key in data.val()) {
console.log(key);
items.push(key);
}
});
var page = tabris.create("Page", {
title: "Hello, World!",
topLevel: true
});
var list = tabris.create("CollectionView", {
layoutData: {left: 0, top: 0, right: 0, bottom: 0},
itemHeight: 25,
items: [1,2,3],
initializeCell: function(cell) {
var textView = tabris.create("TextView", {
layoutData: {left: 30, top: 0, right: 30},
alignment: "center"
}).appendTo(cell);
console.log('created textview');
cell.on("change:item", function(widget, item) {
console.log('change:item');
textView.set("text", item);
});
}
}).appendTo(page);
var button = tabris.create("Button", {
text: "Native Widgets",
layoutData: {centerX: 0, top: 100}
}).appendTo(page);
console.log('created list');
page.open();