@wernfried/daterangepicker 5.5.1 → 5.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/API_Doc.md +21 -6
- package/README.md +21 -20
- package/dist/cjs/daterangepicker.cjs +31 -13
- package/dist/cjs/daterangepicker.cjs.map +1 -1
- package/dist/cjs/daterangepicker.min.cjs +1 -1
- package/dist/cjs/daterangepicker.min.cjs.map +1 -1
- package/dist/esm/daterangepicker.js +31 -13
- package/dist/esm/daterangepicker.js.map +1 -1
- package/dist/esm/daterangepicker.min.js +1 -1
- package/dist/esm/daterangepicker.min.js.map +1 -1
- package/dist/global/daterangepicker.js +31 -13
- package/dist/global/daterangepicker.js.map +1 -1
- package/dist/global/daterangepicker.min.js +1 -1
- package/dist/global/daterangepicker.min.js.map +1 -1
- package/package.json +1 -1
package/API_Doc.md
CHANGED
|
@@ -119,6 +119,7 @@ Ranges are not validated against <code>minDate</code>, <code>maxDate</code>, <co
|
|
|
119
119
|
* [.remove()](#DateRangePicker+remove)
|
|
120
120
|
* [.triggerEvent(ev, ...args)](#DateRangePicker+triggerEvent)
|
|
121
121
|
* [.addEventListener(type, listener, [options])](#DateRangePicker+addEventListener)
|
|
122
|
+
* [.removeEventListener(type, listener, [options])](#DateRangePicker+removeEventListener)
|
|
122
123
|
|
|
123
124
|
<a name="new_DateRangePicker_new"></a>
|
|
124
125
|
|
|
@@ -363,23 +364,37 @@ Helper function to dispatch events
|
|
|
363
364
|
<a name="DateRangePicker+addEventListener"></a>
|
|
364
365
|
|
|
365
366
|
### dateRangePicker.addEventListener(type, listener, [options])
|
|
366
|
-
|
|
367
|
-
|
|
367
|
+
Adding event listener to input element where dateragnepicker is attached to.
|
|
368
|
+
Wrapper to give easy access for `addEventListener()` on DateRangePicker instance.
|
|
368
369
|
|
|
369
370
|
**Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
|
|
370
371
|
|
|
371
372
|
| Param | Type | Description |
|
|
372
373
|
| --- | --- | --- |
|
|
373
|
-
| type | <code>string</code> | The event name (
|
|
374
|
+
| type | <code>string</code> | The event name, either native DOM-Event or [DateRangePicker](API_Doc.md#event) specific event |
|
|
374
375
|
| listener | <code>function</code> | The callback function invoked when the event fires |
|
|
375
376
|
| [options] | <code>boolean</code> \| <code>object</code> | Optional event options: - `boolean capture`: Whether to listen in the capture phase (default: `false`) - `object signal`: An `AbortSignal` for later removal of the listener (default: `undefined`) |
|
|
376
377
|
|
|
377
378
|
**Example**
|
|
378
379
|
```js
|
|
379
|
-
|
|
380
|
-
console.log('Picker element was
|
|
380
|
+
picker.addEventListener('hide', (e) => {
|
|
381
|
+
console.log('Picker element was hidden', e);
|
|
381
382
|
});
|
|
382
383
|
```
|
|
384
|
+
<a name="DateRangePicker+removeEventListener"></a>
|
|
385
|
+
|
|
386
|
+
### dateRangePicker.removeEventListener(type, listener, [options])
|
|
387
|
+
Counterpart to `addEventListener()`
|
|
388
|
+
Note, `listener` most be a named function to enable remove.
|
|
389
|
+
|
|
390
|
+
**Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
|
|
391
|
+
|
|
392
|
+
| Param | Type | Description |
|
|
393
|
+
| --- | --- | --- |
|
|
394
|
+
| type | <code>string</code> | The event name, either native |
|
|
395
|
+
| listener | <code>function</code> | The callback function invoked when the event fires |
|
|
396
|
+
| [options] | <code>boolean</code> \| <code>object</code> | Optional event options: - `boolean capture`: Whether to listen in the capture phase (default: `false`) - `object signal`: An `AbortSignal` for later removal of the listener (default: `undefined`) |
|
|
397
|
+
|
|
383
398
|
<a name="DateRangePickerEvent"></a>
|
|
384
399
|
|
|
385
400
|
## DateRangePickerEvent ⇐ <code>Event</code>
|
|
@@ -679,7 +694,7 @@ Options for DateRangePicker
|
|
|
679
694
|
| timePicker24Hour | <code>boolean</code> | | Use 24-hour instead of 12-hour times, removing the AM/PM selection.<br> Default is derived from current locale [Intl.DateTimeFormat.resolvedOptions.hour12](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/resolvedOptions#hour12). |
|
|
680
695
|
| timePickerStepSize | [<code>Duration</code>](https://moment.github.io/luxon/api-docs/index.html#duration) \| <code>string</code> \| <code>number</code> | | Default: `Duration.fromObject({minutes:1})`<br>Set the time picker step size.<br> Must be a `luxon.Duration` or the number of seconds or a string according to [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) duration.<br> Valid values are 1,2,3,4,5,6,10,12,15,20,30 for `Duration.fromObject({seconds: ...})` and `Duration.fromObject({minutes: ...})` and 1,2,3,4,6,(8,12) for `Duration.fromObject({hours: ...})`.<br> Duration must be greater than `minSpan` and smaller than `maxSpan`.<br> For example `timePickerStepSize: 600` will disable time picker seconds and time picker minutes are set to step size of 10 Minutes. |
|
|
681
696
|
| autoUpdateInput | <code>boolean</code> | <code>true</code> | Indicates whether the DateRangePicker should instantly update the value of the attached `<input>` element when the selected dates change.<br>The `<input>` element will be always updated on `Apply` and reverted when user clicks on `Cancel`. |
|
|
682
|
-
| onOutsideClick | <code>string</code> | <code>"apply"</code> | Defines what picker shall do when user clicks outside the calendar. `
|
|
697
|
+
| onOutsideClick | <code>string</code> | <code>"apply"</code> | Defines what picker shall do when user clicks outside the calendar. `cancel`, `apply` or `hide`. Event [onOutsideClick](#event_outsideClick) is always emitted;<br> `cancel` reverts to previous date values. Note, `apply` is only useful with `autoApply: false`, otherwise date values will apply multiple times<br> If you like to do nothing, call `event.preventDefault()` in the event listener. |
|
|
683
698
|
| linkedCalendars | <code>boolean</code> | <code>true</code> | When enabled, the two calendars displayed will always be for two sequential months (i.e. January and February), and both will be advanced when clicking the left or right arrows above the calendars.<br> When disabled, the two calendars can be individually advanced and display any month/year |
|
|
684
699
|
| isInvalidDate | <code>function</code> | <code>false</code> | A function that is passed each date in the two calendars before they are displayed,<br> and may return `true` or `false` to indicate whether that date should be available for selection or not.<br> Signature: `isInvalidDate(date)`<br> |
|
|
685
700
|
| isInvalidTime | <code>function</code> | <code>false</code> | A function that is passed each hour/minute/second/am-pm in the two calendars before they are displayed,<br> and may return `true` or `false` to indicate whether that date should be available for selection or not.<br> Signature: `isInvalidTime(time, side, unit)`<br> `side` is `'start'` or `'end'` or `null` for `singleDatePicker: true`<br> `unit` is `'hour'`, `'minute'`, `'second'` or `'ampm'`<br> Hours are always given as 24-hour clock<br> Ensure that your function returns `false` for at least one item. Otherwise the calender is not rendered.<br> |
|
package/README.md
CHANGED
|
@@ -19,8 +19,8 @@ Above samples are based on the [original repository](https://github.com/dangross
|
|
|
19
19
|
#### Global import with `<script>` tags
|
|
20
20
|
```html
|
|
21
21
|
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/luxon@3.5.0/build/global/luxon.min.js"></script>
|
|
22
|
-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.5.
|
|
23
|
-
<link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.5.
|
|
22
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.5.2/dist/global/daterangepicker.min.js"></script>
|
|
23
|
+
<link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.5.2/css/daterangepicker.min.css" rel="stylesheet" />
|
|
24
24
|
|
|
25
25
|
<input type="text" id="picker" />
|
|
26
26
|
|
|
@@ -40,11 +40,11 @@ Above samples are based on the [original repository](https://github.com/dangross
|
|
|
40
40
|
{
|
|
41
41
|
"imports": {
|
|
42
42
|
"luxon": "https://cdn.jsdelivr.net/npm/luxon@3.7.2/+esm",
|
|
43
|
-
"daterangepicker": "https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.5.
|
|
43
|
+
"daterangepicker": "https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.5.2/+esm"
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
</script>
|
|
47
|
-
<link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.5.
|
|
47
|
+
<link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.5.2/css/daterangepicker.min.css" rel="stylesheet" />
|
|
48
48
|
|
|
49
49
|
<input type="text" id="picker" />
|
|
50
50
|
|
|
@@ -52,7 +52,7 @@ Above samples are based on the [original repository](https://github.com/dangross
|
|
|
52
52
|
import { DateTime } from 'luxon';
|
|
53
53
|
import { daterangepicker } from 'daterangepicker';
|
|
54
54
|
|
|
55
|
-
daterangepicker('#picker', {
|
|
55
|
+
const picker = daterangepicker('#picker', {
|
|
56
56
|
startDate: DateTime.now().plus({day: 1})
|
|
57
57
|
}, (start, end) => {
|
|
58
58
|
console.log(`Selected range: ${start.toString()} to ${end.toString()}`)
|
|
@@ -63,9 +63,9 @@ Above samples are based on the [original repository](https://github.com/dangross
|
|
|
63
63
|
#### Style with Bulma
|
|
64
64
|
```html
|
|
65
65
|
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/luxon@3.5.0/build/global/luxon.min.js"></script>
|
|
66
|
-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.5.
|
|
66
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.5.2/dist/global/daterangepicker.min.js"></script>
|
|
67
67
|
<link type="text/css" href="https://cdn.jsdelivr.net/npm/bulma@1.0.4/css/bulma.min.css" rel="stylesheet" />
|
|
68
|
-
<link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.5.
|
|
68
|
+
<link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.5.2/css/daterangepicker.bulma.min.css" rel="stylesheet" />
|
|
69
69
|
|
|
70
70
|
<input type="text" id="picker" />
|
|
71
71
|
|
|
@@ -99,16 +99,17 @@ Values in `options` of `daterangepicker(el, options)` take precedence over `data
|
|
|
99
99
|
<script type="module">
|
|
100
100
|
import {daterangepicker, getDateRangePicker} from 'daterangepicker'; // or global import with <script> tag
|
|
101
101
|
|
|
102
|
-
const input =
|
|
102
|
+
const input = document.getElementById('picker');
|
|
103
|
+
const picker = daterangepicker('#picker', {}); // returns DateRangePicker instance or array of DateRangePicker if selector matches more than one element
|
|
103
104
|
// or daterangepicker(document.querySelector('#picker'), {})
|
|
104
105
|
|
|
105
|
-
|
|
106
|
+
// Get DateRangePicker instance after initialization
|
|
107
|
+
const drp = getDateRangePicker(input);
|
|
106
108
|
// or DateRangePicker.getDateRangePicker('#picker'); if imported globally with <script> tag
|
|
107
109
|
|
|
108
|
-
console.log(
|
|
109
|
-
console.log(
|
|
110
|
-
console.log(
|
|
111
|
-
console.log( document.querySelector('#picker') === input) // prints 'true'
|
|
110
|
+
console.log( picker.startDate.toString()) // prints the selected startDate
|
|
111
|
+
console.log( picker === input._daterangepicker) // prints 'true'
|
|
112
|
+
console.log( picker.element === input) // prints 'true'
|
|
112
113
|
</script>
|
|
113
114
|
```
|
|
114
115
|
|
|
@@ -121,8 +122,8 @@ Initialisation with jQuery is supported in version 5.x
|
|
|
121
122
|
```html
|
|
122
123
|
<script type="text/javascript" src="https://cdn.jsdelivr.net/jquery/latest/jquery.min.js"></script>
|
|
123
124
|
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/luxon@3.5.0/build/global/luxon.min.js"></script>
|
|
124
|
-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.5.
|
|
125
|
-
<link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.5.
|
|
125
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.5.2/dist/global/daterangepicker.min.js"></script>
|
|
126
|
+
<link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.5.2/css/daterangepicker.min.css" rel="stylesheet" />
|
|
126
127
|
|
|
127
128
|
<input type="text" id="picker" />
|
|
128
129
|
|
|
@@ -161,7 +162,7 @@ $('#picker').daterangepicker({
|
|
|
161
162
|
});
|
|
162
163
|
|
|
163
164
|
// version 5.x - without jQuery
|
|
164
|
-
const
|
|
165
|
+
const picker = daterangepicker('#picker', { // or DateRangePicker.daterangepicker('#picker', ...
|
|
165
166
|
startDate: DateTime.now(),
|
|
166
167
|
// allow only dates from current year
|
|
167
168
|
minDate: DateTime.now().startOf('year'),
|
|
@@ -169,14 +170,14 @@ const input = daterangepicker('#picker', { // or DateRangePicker.daterangepicker
|
|
|
169
170
|
singleDatePicker: true
|
|
170
171
|
});
|
|
171
172
|
|
|
172
|
-
|
|
173
|
+
picker.addEventListener('violate', (ev) => {
|
|
173
174
|
ev.newDate.startDate = DateTime.now().minus({ days: 3 }).startOf('day');
|
|
174
175
|
ev.preventDefault();
|
|
175
176
|
});
|
|
176
|
-
|
|
177
|
+
picker.addEventListener('show', (ev) => {
|
|
177
178
|
console.log('Show the picker')
|
|
178
179
|
});
|
|
179
|
-
|
|
180
|
+
picker.addEventListener('beforeHide', (ev) => {
|
|
180
181
|
console.log(ev.picker.startDate.toString());
|
|
181
182
|
ev.preventDefault(); // -> do not hide the picker
|
|
182
183
|
});
|
|
@@ -371,7 +372,7 @@ Options for DateRangePicker
|
|
|
371
372
|
| timePicker24Hour | <code>boolean</code> | | Use 24-hour instead of 12-hour times, removing the AM/PM selection.<br> Default is derived from current locale [Intl.DateTimeFormat.resolvedOptions.hour12](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/resolvedOptions#hour12). |
|
|
372
373
|
| timePickerStepSize | [<code>Duration</code>](https://moment.github.io/luxon/api-docs/index.html#duration) \| <code>string</code> \| <code>number</code> | | Default: `Duration.fromObject({minutes:1})`<br>Set the time picker step size.<br> Must be a `luxon.Duration` or the number of seconds or a string according to [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) duration.<br> Valid values are 1,2,3,4,5,6,10,12,15,20,30 for `Duration.fromObject({seconds: ...})` and `Duration.fromObject({minutes: ...})` and 1,2,3,4,6,(8,12) for `Duration.fromObject({hours: ...})`.<br> Duration must be greater than `minSpan` and smaller than `maxSpan`.<br> For example `timePickerStepSize: 600` will disable time picker seconds and time picker minutes are set to step size of 10 Minutes. |
|
|
373
374
|
| autoUpdateInput | <code>boolean</code> | <code>true</code> | Indicates whether the DateRangePicker should instantly update the value of the attached `<input>` element when the selected dates change.<br>The `<input>` element will be always updated on `Apply` and reverted when user clicks on `Cancel`. |
|
|
374
|
-
| onOutsideClick | <code>string</code> | <code>"apply"</code> | Defines what picker shall do when user clicks outside the calendar. `
|
|
375
|
+
| onOutsideClick | <code>string</code> | <code>"apply"</code> | Defines what picker shall do when user clicks outside the calendar. `cancel`, `apply` or `hide`. Event [onOutsideClick](#event_outsideClick) is always emitted;<br> `cancel` reverts to previous date values. Note, `apply` is only useful with `autoApply: false`, otherwise date values will apply multiple times<br> If you like to do nothing, call `event.preventDefault()` in the event listener. |
|
|
375
376
|
| linkedCalendars | <code>boolean</code> | <code>true</code> | When enabled, the two calendars displayed will always be for two sequential months (i.e. January and February), and both will be advanced when clicking the left or right arrows above the calendars.<br> When disabled, the two calendars can be individually advanced and display any month/year |
|
|
376
377
|
| isInvalidDate | <code>function</code> | <code>false</code> | A function that is passed each date in the two calendars before they are displayed,<br> and may return `true` or `false` to indicate whether that date should be available for selection or not.<br> Signature: `isInvalidDate(date)`<br> |
|
|
377
378
|
| isInvalidTime | <code>function</code> | <code>false</code> | A function that is passed each hour/minute/second/am-pm in the two calendars before they are displayed,<br> and may return `true` or `false` to indicate whether that date should be available for selection or not.<br> Signature: `isInvalidTime(time, side, unit)`<br> `side` is `'start'` or `'end'` or `null` for `singleDatePicker: true`<br> `unit` is `'hour'`, `'minute'`, `'second'` or `'ampm'`<br> Hours are always given as 24-hour clock<br> Ensure that your function returns `false` for at least one item. Otherwise the calender is not rendered.<br> |
|
|
@@ -454,10 +454,10 @@ class DateRangePicker {
|
|
|
454
454
|
this.buttonClasses = options.buttonClasses;
|
|
455
455
|
}
|
|
456
456
|
if (typeof options.onOutsideClick === "string") {
|
|
457
|
-
if (["cancel", "apply"].includes(options.onOutsideClick))
|
|
457
|
+
if (["cancel", "apply", "hide"].includes(options.onOutsideClick))
|
|
458
458
|
this.onOutsideClick = options.onOutsideClick;
|
|
459
459
|
else
|
|
460
|
-
console.error(`Option 'onOutsideClick' must be 'cancel' or '
|
|
460
|
+
console.error(`Option 'onOutsideClick' must be 'cancel', 'apply' or 'hide'`);
|
|
461
461
|
}
|
|
462
462
|
if (this.locale.firstDay != 1) {
|
|
463
463
|
let iterator = this.locale.firstDay;
|
|
@@ -1698,14 +1698,10 @@ class DateRangePicker {
|
|
|
1698
1698
|
*/
|
|
1699
1699
|
hide() {
|
|
1700
1700
|
if (!this.isShowing) return;
|
|
1701
|
-
if (!this.#endDate) {
|
|
1701
|
+
if (!this.#endDate && !this.singleDatePicker) {
|
|
1702
1702
|
this.#startDate = this.oldStartDate;
|
|
1703
1703
|
this.#endDate = this.oldEndDate;
|
|
1704
1704
|
}
|
|
1705
|
-
if (typeof this.callback === "function") {
|
|
1706
|
-
if (this.#startDate && !this.#startDate.equals(this.oldStartDate ?? luxon.DateTime) || this.#endDate && !this.singleDatePicker && !this.#endDate.equals(this.oldEndDate ?? luxon.DateTime))
|
|
1707
|
-
this.callback(this.startDate, this.endDate, this.chosenLabel);
|
|
1708
|
-
}
|
|
1709
1705
|
this.updateElement();
|
|
1710
1706
|
const event = this.triggerEvent(this.#events.onBeforeHide);
|
|
1711
1707
|
if (event.defaultPrevented)
|
|
@@ -1777,8 +1773,12 @@ class DateRangePicker {
|
|
|
1777
1773
|
if (this.onOutsideClick === "cancel") {
|
|
1778
1774
|
this.#startDate = this.oldStartDate;
|
|
1779
1775
|
this.#endDate = this.oldEndDate;
|
|
1776
|
+
this.hide();
|
|
1777
|
+
} else if (this.onOutsideClick === "apply") {
|
|
1778
|
+
this.clickApply();
|
|
1779
|
+
} else {
|
|
1780
|
+
this.hide();
|
|
1780
1781
|
}
|
|
1781
|
-
this.hide();
|
|
1782
1782
|
}
|
|
1783
1783
|
/**
|
|
1784
1784
|
* Move calendar to previous month
|
|
@@ -2141,6 +2141,11 @@ class DateRangePicker {
|
|
|
2141
2141
|
* @private
|
|
2142
2142
|
*/
|
|
2143
2143
|
clickApply() {
|
|
2144
|
+
this.updateElement();
|
|
2145
|
+
if (typeof this.callback === "function") {
|
|
2146
|
+
if (this.#startDate && (this.#endDate || !this.singleDatePicker))
|
|
2147
|
+
this.callback(this.startDate, this.endDate, this.chosenLabel);
|
|
2148
|
+
}
|
|
2144
2149
|
this.hide();
|
|
2145
2150
|
this.triggerEvent(this.#events.onApply);
|
|
2146
2151
|
}
|
|
@@ -2335,24 +2340,37 @@ class DateRangePicker {
|
|
|
2335
2340
|
});
|
|
2336
2341
|
}
|
|
2337
2342
|
/**
|
|
2338
|
-
*
|
|
2339
|
-
*
|
|
2343
|
+
* Adding event listener to input element where dateragnepicker is attached to.
|
|
2344
|
+
* Wrapper to give easy access for `addEventListener()` on DateRangePicker instance.
|
|
2340
2345
|
*
|
|
2341
|
-
* @param {string} type - The event name (
|
|
2346
|
+
* @param {string} type - The event name, either native DOM-Event or [DateRangePicker](API_Doc.md#event) specific event
|
|
2342
2347
|
* @param {function} listener - The callback function invoked when the event fires
|
|
2343
2348
|
* @param {boolean|object} [options] - Optional event options:
|
|
2344
2349
|
* - `boolean capture`: Whether to listen in the capture phase (default: `false`)
|
|
2345
2350
|
* - `object signal`: An `AbortSignal` for later removal of the listener (default: `undefined`)
|
|
2346
2351
|
*
|
|
2347
2352
|
* @example
|
|
2348
|
-
*
|
|
2349
|
-
* console.log('Picker element was
|
|
2353
|
+
* picker.addEventListener('hide', (e) => {
|
|
2354
|
+
* console.log('Picker element was hidden', e);
|
|
2350
2355
|
* });
|
|
2351
2356
|
*
|
|
2352
2357
|
*/
|
|
2353
2358
|
addEventListener(type, listener, options) {
|
|
2354
2359
|
this.element.addEventListener(type, listener, options);
|
|
2355
2360
|
}
|
|
2361
|
+
/**
|
|
2362
|
+
* Counterpart to `addEventListener()`
|
|
2363
|
+
* Note, `listener` most be a named function to enable remove.
|
|
2364
|
+
*
|
|
2365
|
+
* @param {string} type - The event name, either native
|
|
2366
|
+
* @param {function} listener - The callback function invoked when the event fires
|
|
2367
|
+
* @param {boolean|object} [options] - Optional event options:
|
|
2368
|
+
* - `boolean capture`: Whether to listen in the capture phase (default: `false`)
|
|
2369
|
+
* - `object signal`: An `AbortSignal` for later removal of the listener (default: `undefined`)
|
|
2370
|
+
*/
|
|
2371
|
+
removeEventListener(type, listener, options) {
|
|
2372
|
+
this.element.removeEventListener(type, listener, options);
|
|
2373
|
+
}
|
|
2356
2374
|
}
|
|
2357
2375
|
function createElementFromHTML(html) {
|
|
2358
2376
|
const template = document.createElement("template");
|