-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
72 lines (65 loc) · 2.06 KB
/
main.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//window.onload = function() {
// console.log('+[window.onload]');
// // Do nothing now
// var url = "https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=MSFT&apikey=demo";
// console.log(document.getElementById('debug '));
// document.addEventListener('visibilityChange', visibilityChanged, false);
//
// function visibilityChanged() {
// console.log("VISIBILITY");
// document.getElementById("debug").innerHTML = "Blah";
// }
//};
//
//
//function getDataFromNetwork(file, handler) {
// var xhr = new XMLHttpRequest();
// xhr.open('GET', file, true);
// xhr.onreadystatechange = handler;
// xhr.onload = function() {
// if (this.status == 200) {
// /* Handle the response */
// }
// };
// xhr.send();
//}
//
///* If getting JSON data */
//function handleResponseJSON(e) {
// if (e.target.readyState == 4) {
// if (e.target.status == 200) {
//// var data = JSON.parse(e.target.responseText);
// console.log(e);
// console.log(e.target);
// console.log(e.target.responeText);
// } else {
// /* Error handling */
// }
// }
//}
(function() {
var mytext = 'something';
function keyEventHandler(event) {
document.getElementById('debug').textContent = "Key event";
// if (event.keyName === "back") {
// try {
//// tizen.application.getCurrentApplication().exit();
// document.getElementById('debug').textContent = "Back key";
// } catch (ignore) {}
// }
}
function visibilityChanged(event) {
document.getElementById('debug').textContent = event.visibilityState;
}
/**
* Initializes the application
* @private
*/
function init() {
document.getElementById('debug').textContent = mytext;
document.addEventListener('tizenhwkey', keyEventHandler);
document.addEventListener('visibilityChange', visibilityChanged);
document.addEventListener("webkitvisibilitychange", visibilityChange);
}
window.onload = init();
}());