Skip to content

removeEvent

Remove event listener.

Usage

js
import { removeEvent } from 'js-cool'

Signature

typescript
function removeEvent(
  element: any,
  type: string,
  handler: Function
): void

Parameters

ParameterTypeDescription
elementanyDOM element
typestringEvent type (no 'on')
handlerFunctionEvent handler

Examples

js
const handler = (e) => console.log('clicked')
addEvent(btn, 'click', handler)

// Later, remove the handler
removeEvent(btn, 'click', handler)

Released under the MIT License.