Skip to content

Commit

Permalink
v0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nk-o committed Nov 27, 2023
1 parent b31fa1e commit 604713f
Show file tree
Hide file tree
Showing 12 changed files with 54 additions and 16 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## [0.2.0] - Nov 28, 2023

- added custom `ready` event support
- added event switch from `pointerenter` to `pointerover` and `pointerleave` to `pointerout` when event delegation is used

## [0.1.0] - Nov 26, 2023

- initial release
15 changes: 13 additions & 2 deletions dist/ivent.cjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* ivent v0.1.1 (https://github.com/nk-crew/ivent)
* ivent v0.2.0 (https://github.com/nk-crew/ivent)
* Copyright 2023 nK <https://nkdev.info>
* Licensed under MIT (https://github.com/nk-crew/ivent/blob/master/LICENSE)
*/
Expand All @@ -20,7 +20,9 @@ const namespaceRegex = /[^.]*(?=\..*)\.|.*/;
const stripNameRegex = /\..*/;
const customEvents = {
mouseenter: 'mouseover',
mouseleave: 'mouseout'
mouseleave: 'mouseout',
pointerenter: 'pointerover',
pointerleave: 'pointerout'
};
function parseEventName(name) {
// Get the native events from namespaced events ('click.ghostkit.button' --> 'click')
Expand Down Expand Up @@ -160,6 +162,15 @@ function addHandler(element, originalTypeEvent, handler, delegationFunction, one
fn.oneOff = oneOff;
fn.uidEvent = uid;
handlers[uid] = fn;

// Add support for custom event handler `ready` for DOMContentLoaded.
if (element === document && typeEvent === 'ready' && !isDelegated) {
typeEvent = 'DOMContentLoaded';
if (document.readyState !== 'loading') {
fn(new CustomEvent('ready'));
return;
}
}
element.addEventListener(typeEvent, fn, isDelegated);
}
function removeHandler(element, events, typeEvent, handler, delegationSelector) {
Expand Down
2 changes: 1 addition & 1 deletion dist/ivent.cjs.map

Large diffs are not rendered by default.

15 changes: 13 additions & 2 deletions dist/ivent.esm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/ivent.esm.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/ivent.esm.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/ivent.esm.min.js.map

Large diffs are not rendered by default.

15 changes: 13 additions & 2 deletions dist/ivent.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/ivent.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/ivent.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/ivent.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ivent",
"version": "0.1.1",
"version": "0.2.0",
"description": "Helper functions for browser event listener",
"license": "MIT",
"homepage": "https://github.com/nk-crew/ivent",
Expand Down

0 comments on commit 604713f

Please sign in to comment.