summaryrefslogtreecommitdiffstats
path: root/core/js/eventsource.js
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-06-23 23:56:10 +0200
committerVincent Petry <pvince81@owncloud.com>2014-10-31 13:43:30 +0100
commit0f3e6cb50af06bf3a64ea7f1abd360c53fa0bf8c (patch)
treed605ccd4c63eff5c694ad016db5ca43d965e9e17 /core/js/eventsource.js
parentc7dc656b2bf956758dbf8979ff6b7597d627b884 (diff)
downloadnextcloud-server-0f3e6cb50af06bf3a64ea7f1abd360c53fa0bf8c.tar.gz
nextcloud-server-0f3e6cb50af06bf3a64ea7f1abd360c53fa0bf8c.zip
Improved Javascript docs for JSDoc
Added namespaces so that JSDoc can find them. Fixed a few warnings. Improved some comments.
Diffstat (limited to 'core/js/eventsource.js')
-rw-r--r--core/js/eventsource.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/core/js/eventsource.js b/core/js/eventsource.js
index 46bd9f60bb5..6f23cebb685 100644
--- a/core/js/eventsource.js
+++ b/core/js/eventsource.js
@@ -34,6 +34,8 @@
* Create a new event source
* @param {string} src
* @param {object} [data] to be send as GET
+ *
+ * @constructs OC.EventSource
*/
OC.EventSource=function(src,data){
var dataStr='';
@@ -92,6 +94,16 @@ OC.EventSource.prototype={
iframe:null,
listeners:{},//only for fallback
useFallBack:false,
+ /**
+ * Fallback callback for browsers that don't have the
+ * native EventSource object.
+ *
+ * Calls the registered listeners.
+ *
+ * @private
+ * @param {String} type event type
+ * @param {Object} data received data
+ */
fallBackCallBack:function(type,data){
var i;
// ignore messages that might appear after closing
@@ -111,6 +123,12 @@ OC.EventSource.prototype={
}
},
lastLength:0,//for fallback
+ /**
+ * Listen to a given type of events.
+ *
+ * @param {String} type event type
+ * @param {Function} callback event callback
+ */
listen:function(type,callback){
if(callback && callback.call){
@@ -134,6 +152,9 @@ OC.EventSource.prototype={
}
}
},
+ /**
+ * Closes this event source.
+ */
close:function(){
this.closed = true;
if (typeof this.source !== 'undefined') {