delphimvcframework/samples/pushnotifications_server/bin/www/myworkers.js
Daniele Teti 14c4489f41 New Demos
2016-11-07 14:33:05 +01:00

22 lines
482 B
JavaScript

importScripts('ajax.js')
var ajax = new AJAX();
var clientid = null;
function loop() {
ajax.get('/topics/test1/' + clientid, function(status, response) {
if (status == 200) {
//console.log(response);
var json = JSON.parse(response);
//console.log(json);
self.postMessage(json);
setTimeout(loop, 500);
}
});
}
self.onmessage = function(event) {
self.clientid = event.data;
self.loop();
}