initial commit
[namibia] / public / js / vendor / ape-source / Transport / Transport.SSE.js
1 /* Notice : This class in only intended to be use as an implemented class */
2 APE.Request.SSE = new Class({
3         SSESupport: ((typeof window.addEventStream) == 'function'), 
4
5         initSSE: function(queryString, options, readCallback) {
6                 var tmp = document.createElement('div');
7                 document.body.appendChild(tmp);
8                 tmp.innerHTML = '<event-source src="' + this.ape.serverUri + queryString + '&' + $time() + '" id="APE_SSE">';
9                 this.eventSource = document.getElementById('APE_SSE');
10                 this.eventSource.addEventListener('ape-data', function(ev) { readCallback.run(ev.data) }, false);
11         }
12 });