Created
June 23, 2014 03:59
-
-
Save oshanz/e9bdb0c4cfb5ac105734 to your computer and use it in GitHub Desktop.
observer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var worker = new Worker(URL + "view/gmapsRoute/js/observer.js"); | |
worker.postMessage("sdfdf"); | |
worker.onmessage = function(event) { | |
alert("Received message " + event.data); | |
worker.terminate(); | |
}; | |
************************************************************************************* | |
/** | |
* @author Waruna Oshan Wisumperuma | |
* @contact warunaoshan@gmail.com | |
*/ | |
onmessage = function(event) { | |
postMessage(event.data); | |
setInterval(function getLatestGeo() { | |
postMessage('a'); | |
// var xmlhttp = new XMLHttpRequest(); | |
// xmlhttp.onreadystatechange = function() { | |
// if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { | |
// console.log(xmlhttp.responseText); | |
// } | |
// }; | |
// xmlhttp.open("GET", "latestGeo?lastGeoId=" + lastGeoId); | |
// xmlhttp.send(); | |
}, 30000); | |
}; | |
//importScripts("XMLHttpRequest.js"); | |
// | |
//onmessage = function(event) { | |
// var xhr = creatXMLHTTPRequest(); | |
// xhr.open('GET', 'widgets/widgetDefinition' + event.data + '.xml', true); | |
// xhr.send(null); | |
// xhr.onreadystatechange = function() { | |
// if (xhr.readyState == 4) { | |
// if (xhr.status == 200 || xhr.status ==0) { | |
// postMessage(xhr.responseText); | |
// } else { | |
// throw xhr.status + xhr.responseText; | |
// } | |
// } | |
// } | |
//} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment