()
| 54 | // since the app is a rudimentary webserver on port 34013, we check if it's |
| 55 | // running by sending it a "hello" request and verifying the response |
| 56 | function checkForApp() { |
| 57 | if (appDetected) { |
| 58 | appFound(); |
| 59 | } |
| 60 | var xmp = new XMLHttpRequest(); |
| 61 | var timeout; |
| 62 | xmp.open("GET", appUrl + "/hello", true); |
| 63 | xmp.onreadystatechange = function() { |
| 64 | if (xmp.readyState == 4) { |
| 65 | clearTimeout(timeout); |
| 66 | if (xmp.responseText != 'Hello') { |
| 67 | appNotFound(); |
| 68 | } else { |
| 69 | appFound(); |
| 70 | } |
| 71 | } |
| 72 | }; |
| 73 | timeout = setTimeout(appNotFound, 100); |
| 74 | xmp.send(); |
| 75 | } |
| 76 | |
| 77 | function askUser(type, data, aux) { |
| 78 | var identifier = Date.now().toString() + Math.random().toString().substr(2); |
no test coverage detected