From 2237f026c976b3367524b978ff81eb067e78ac51 Mon Sep 17 00:00:00 2001 From: Svein-Tore Griff With Date: Mon, 16 Feb 2015 14:26:09 +0100 Subject: [PATCH] Documentation updates --- js/event-dispatcher.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/js/event-dispatcher.js b/js/event-dispatcher.js index 36066ca..25a3b5c 100644 --- a/js/event-dispatcher.js +++ b/js/event-dispatcher.js @@ -34,7 +34,7 @@ H5P.EventDispatcher = (function () { * @throws {TypeError} listener - Must be a function * @param {String} type - Event type * @param {Function} listener - Event listener - * @param {Function} thisArg - Optional thisArg to call the listener from + * @param {Function} thisArg - Optionally specify the this value when calling listener. */ self.on = function (type, listener, thisArg) { if (thisArg === undefined) { @@ -61,9 +61,10 @@ H5P.EventDispatcher = (function () { * Add new event listener that will be fired only once. * * @public - * @throws {TypeError} listener must be a function - * @param {String} type Event type - * @param {Function} listener Event listener + * @throws {TypeError} listener - must be a function + * @param {String} type - Event type + * @param {Function} listener - Event listener + * @param {Function} thisArg - Optionally specify the this value when calling listener. */ self.once = function (type, listener, thisArg) { if (thisArg === undefined) { @@ -86,9 +87,9 @@ H5P.EventDispatcher = (function () { * If no listener is specified, all listeners will be removed. * * @public - * @throws {TypeError} listener must be a function - * @param {String} type Event type - * @param {Function} [listener] Event listener + * @throws {TypeError} listener - must be a function + * @param {String} type - Event type + * @param {Function} listener - Event listener */ self.off = function (type, listener) { if (listener !== undefined && !(listener instanceof Function)) { @@ -125,8 +126,10 @@ H5P.EventDispatcher = (function () { * Dispatch event. * * @public - * @param {String|Function} - * + * @param {String|Function} event - Event object or event type as string + * @param {mixed} eventData + * Custom event data(used when event type as string is used as first + * argument */ self.trigger = function (event, eventData) { if (event === undefined) {