Documentation updates

d6
Svein-Tore Griff With 2015-02-16 14:26:09 +01:00
parent 10fbca1549
commit 2237f026c9
1 changed files with 12 additions and 9 deletions

View File

@ -34,7 +34,7 @@ H5P.EventDispatcher = (function () {
* @throws {TypeError} listener - Must be a function * @throws {TypeError} listener - Must be a function
* @param {String} type - Event type * @param {String} type - Event type
* @param {Function} listener - Event listener * @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) { self.on = function (type, listener, thisArg) {
if (thisArg === undefined) { if (thisArg === undefined) {
@ -61,9 +61,10 @@ H5P.EventDispatcher = (function () {
* Add new event listener that will be fired only once. * Add new event listener that will be fired only once.
* *
* @public * @public
* @throws {TypeError} listener must be a function * @throws {TypeError} listener - must be a function
* @param {String} type Event type * @param {String} type - Event type
* @param {Function} listener Event listener * @param {Function} listener - Event listener
* @param {Function} thisArg - Optionally specify the this value when calling listener.
*/ */
self.once = function (type, listener, thisArg) { self.once = function (type, listener, thisArg) {
if (thisArg === undefined) { if (thisArg === undefined) {
@ -86,9 +87,9 @@ H5P.EventDispatcher = (function () {
* If no listener is specified, all listeners will be removed. * If no listener is specified, all listeners will be removed.
* *
* @public * @public
* @throws {TypeError} listener must be a function * @throws {TypeError} listener - must be a function
* @param {String} type Event type * @param {String} type - Event type
* @param {Function} [listener] Event listener * @param {Function} listener - Event listener
*/ */
self.off = function (type, listener) { self.off = function (type, listener) {
if (listener !== undefined && !(listener instanceof Function)) { if (listener !== undefined && !(listener instanceof Function)) {
@ -125,8 +126,10 @@ H5P.EventDispatcher = (function () {
* Dispatch event. * Dispatch event.
* *
* @public * @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) { self.trigger = function (event, eventData) {
if (event === undefined) { if (event === undefined) {