Comparing version 1.2.0 to 1.3.0
@@ -17,2 +17,3 @@ import inViewport from './src/dimension/in-viewport'; | ||
import on from './src/event/on'; | ||
import onTransitionEnd from './src/event/on-transition-end'; | ||
import ready from './src/event/ready'; | ||
@@ -45,2 +46,3 @@ | ||
on, | ||
onTransitionEnd, | ||
off, | ||
@@ -47,0 +49,0 @@ ready, |
{ | ||
"name": "domestique", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "A modular DOM helper library.", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/jsor/domestique.git", |
@@ -60,2 +60,3 @@ Domestique | ||
on, | ||
onTransitionEnd, | ||
off, | ||
@@ -92,2 +93,3 @@ delegate, | ||
* [on()](#on) | ||
* [onTransitionEnd()](#ontransitionend) | ||
* [off()](#off) | ||
@@ -378,2 +380,30 @@ * [delegate()](#delegate) | ||
#### onTransitionEnd() | ||
``` | ||
onTransitionEnd(target: EventTarget, listener: EventListener): function | ||
``` | ||
Registers a one-time `listener` for the `transitionend` event on `target`. | ||
The function returns another function which can be used to unregister the event listener. | ||
##### Example | ||
```javascript | ||
const target = document.querySelector('.my-element'); | ||
const listener = function (target) { | ||
target.classList.add('transition-ended'); | ||
console.log('Transition ended'); | ||
}; | ||
const remove = onTransitionEnd( | ||
target, | ||
listener | ||
); | ||
remove(); // Remove event listener | ||
``` | ||
#### off() | ||
@@ -413,3 +443,5 @@ | ||
```javascript | ||
const listener = function () { | ||
const listener = function (e, target) { | ||
target.classList.add('my-target-clicked'); | ||
console.log('My Button clicked'); | ||
@@ -416,0 +448,0 @@ }; |
@@ -28,3 +28,3 @@ import closest from '../query/closest'; | ||
listener.call(delegateTarget, event); | ||
listener.call(delegateTarget, event, delegateTarget); | ||
}, options); | ||
@@ -31,0 +31,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27645
26
484
548