@descope/web-components-ui 1.0.172 → 1.0.173

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@descope/web-components-ui",
3
- "version": "1.0.172",
3
+ "version": "1.0.173",
4
4
  "description": "",
5
5
  "main": "dist/cjs/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -50,6 +50,7 @@
50
50
  "license": "UNLICENSED",
51
51
  "devDependencies": {
52
52
  "@babel/preset-env": "^7.22.2",
53
+ "@jest/globals": "^29.7.0",
53
54
  "@playwright/test": "^1.38.1",
54
55
  "@rollup/plugin-node-resolve": "^15.0.2",
55
56
  "@storybook/addon-actions": "^6.4.9",
@@ -8,39 +8,3 @@ export function createDispatchEvent(eventName, options = {}) {
8
8
  this[`on${eventName}`]?.(event); // in case we got an event callback as property
9
9
  this.dispatchEvent(event);
10
10
  }
11
-
12
- // add an event listener that is automatically removed on disconnect
13
- // usage example:
14
- // createEventListener.call(this,'change', this.onChange, { element? , ...options })
15
- export function createEventListener(event, callback, { element, ...options } = {}) {
16
- const timerId = setTimeout(
17
- () =>
18
- // eslint-disable-next-line no-console
19
- console.warn(
20
- this.localName,
21
- 'is not using "lifecycleEventsMixin", events will not be removed automatically on disconnect'
22
- ),
23
- 2000
24
- );
25
-
26
- this.addEventListener(
27
- 'connected',
28
- () => {
29
- clearTimeout(timerId);
30
- },
31
- { once: true }
32
- );
33
-
34
- const targetEle = element || this;
35
- const boundCallback = callback.bind(this);
36
-
37
- const onDisconnect = () => {
38
- targetEle.removeEventListener(event, boundCallback);
39
- };
40
-
41
- this.addEventListener('disconnected', onDisconnect, { once: true });
42
-
43
- targetEle.addEventListener(event, boundCallback, options);
44
-
45
- return onDisconnect;
46
- }