@acanto/core-dom
Advanced tools
Comparing version 0.0.10 to 0.0.11
16
index.js
@@ -30,3 +30,3 @@ /** | ||
* @param {string} selector DOM selector | ||
* @param {HTMLElement} [parent] It falls back to `window.document` | ||
* @param {HTMLElement | Document} [parent] It falls back to `window.document` | ||
* @returns {HTMLElement} | ||
@@ -48,3 +48,3 @@ * @example <caption>Basic DOM selection</caption> | ||
* @param {string} selector DOM selector | ||
* @param {HTMLElement} [parent] It falls back to `window.document` | ||
* @param {HTMLElement | Document} [parent] It falls back to `window.document` | ||
* @returns {NodeList} | ||
@@ -140,2 +140,8 @@ */ | ||
export function on(el, type, handler, options = false) { | ||
if (__DEV__) { | ||
if (!el) { | ||
console.error("Used `on` with an unexisting DOM element"); | ||
return; | ||
} | ||
} | ||
el.addEventListener(type, handler, options); | ||
@@ -153,2 +159,8 @@ } | ||
export function off(el, type, handler, options = false) { | ||
if (__DEV__) { | ||
if (!el) { | ||
console.error("Used `on` with an unexisting DOM element"); | ||
return; | ||
} | ||
} | ||
el.removeEventListener(type, handler, options); | ||
@@ -155,0 +167,0 @@ } |
{ | ||
"name": "@acanto/core-dom", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"author": "Acanto <info@acanto.net> (https://acanto.agency/)", | ||
@@ -18,3 +18,3 @@ "license": "ISC", | ||
"sideEffects": false, | ||
"gitHead": "eae265cfc6d54a26582b74e6ef165fd78ea8cafe" | ||
"gitHead": "f2dd0eab0e87e64b18f7ff86b837054aaa34a198" | ||
} |
22641
741