Releases: fregante/delegate-it
Releases Β· fregante/delegate-it
Release list
v6.4.0
v6.3.0
v6.2.1
v6.2.0
v6.1.0
v6.0.1
v6.0.0
Breaking changes
Move base to options (#46) 247ac87
- delegate(document, 'a', 'click', alert)
+ delegate('a', 'click', alert)- delegate(myBaseElement, 'a', 'click', alert)
+ delegate('a', 'click', alert, {base: myBaseElement})Drop support for boolean-only options (#44) 7b3dc8a
- delegate(document, 'a', 'click', alert, true)
+ delegate('a', 'click', alert, {capture: true})Drop support for selectors and arrays as base (#45) 5b5138b
- delegate('.my-base-element', 'a', 'click', alert)- delegate(document.querySelectorAll('.my-base-element'), 'a', 'click', alert)New
Add promised oneEvent listener (#41) 5697313
+ await oneEvent('a', 'click')
+ console.log('link was clicked')Add support for once (#40) 39dcce7
+ delegate('a', 'click', alert, {once: true})v5.0.0
Breaking changes
Migration
Listener removal
v3 (old)
const delegation = delegate(document, 'a', 'click', console.log);
delegation.destroy();v4 (old)
const controller = delegate(document, 'a', 'click', console.log);
controller.abort();v5 (new)
This was already possible in v4, so if you were using this pattern, you don't need to change anything.
const controller = new AbortController();
delegate(document, 'a', 'click', console.log, {signal: controller.signal});
controller.abort();v4.0.1
v4.0.0
Breaking changes
- Only accept iterables, not any array-likes ec3232d by @fregante
- Output modern code 6ac66e2 by @fregante
- Return
AbortControllerinstead of{destroy()}+ supportsignal(#28) 4f3d7ea by @cheap-glitch
Migration
Listener removal
Before:
const delegation = delegate(document, 'a', 'click', console.log);
delegation.destroy();After:
const controller = delegate(document, 'a', 'click', console.log);
controller.abort();
// or provide your own signal
const controller = new AbortController();
delegate(document, 'a', 'click', console.log, {signal: controller.signal});
controller.abort();Types
Before:
import delegate from 'delegate-it'
function listener(event: delegate.Event) {}After:
import delegate, {DelegateEvent} from 'delegate-it'
function listener(event: DelegateEvent) {}