improve jsdoc comments
This commit is contained in:
@@ -4,6 +4,8 @@ import * as f from 'lib0/function.js'
|
||||
* General event handler implementation.
|
||||
*
|
||||
* @template ARG0, ARG1
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
export class EventHandler {
|
||||
constructor () {
|
||||
@@ -17,6 +19,9 @@ export class EventHandler {
|
||||
/**
|
||||
* @template ARG0,ARG1
|
||||
* @returns {EventHandler<ARG0,ARG1>}
|
||||
*
|
||||
* @private
|
||||
* @function
|
||||
*/
|
||||
export const createEventHandler = () => new EventHandler()
|
||||
|
||||
@@ -27,6 +32,9 @@ export const createEventHandler = () => new EventHandler()
|
||||
* @template ARG0,ARG1
|
||||
* @param {EventHandler<ARG0,ARG1>} eventHandler
|
||||
* @param {function(ARG0,ARG1):void} f The event handler.
|
||||
*
|
||||
* @private
|
||||
* @function
|
||||
*/
|
||||
export const addEventHandlerListener = (eventHandler, f) =>
|
||||
eventHandler.l.push(f)
|
||||
@@ -38,6 +46,9 @@ export const addEventHandlerListener = (eventHandler, f) =>
|
||||
* @param {EventHandler<ARG0,ARG1>} eventHandler
|
||||
* @param {function(ARG0,ARG1):void} f The event handler that was added with
|
||||
* {@link EventHandler#addEventListener}
|
||||
*
|
||||
* @private
|
||||
* @function
|
||||
*/
|
||||
export const removeEventHandlerListener = (eventHandler, f) => {
|
||||
eventHandler.l = eventHandler.l.filter(g => f !== g)
|
||||
@@ -47,6 +58,9 @@ export const removeEventHandlerListener = (eventHandler, f) => {
|
||||
* Removes all event listeners.
|
||||
* @template ARG0,ARG1
|
||||
* @param {EventHandler<ARG0,ARG1>} eventHandler
|
||||
*
|
||||
* @private
|
||||
* @function
|
||||
*/
|
||||
export const removeAllEventHandlerListeners = eventHandler => {
|
||||
eventHandler.l.length = 0
|
||||
@@ -59,6 +73,9 @@ export const removeAllEventHandlerListeners = eventHandler => {
|
||||
* @template ARG0,ARG1
|
||||
* @param {EventHandler<ARG0,ARG1>} eventHandler
|
||||
* @param {[ARG0,ARG1]} args
|
||||
*
|
||||
* @private
|
||||
* @function
|
||||
*/
|
||||
export const callEventHandlerListeners = (eventHandler, args) =>
|
||||
f.callAll(eventHandler.l, args)
|
||||
|
||||
Reference in New Issue
Block a user