@thednp/event-listener
Advanced tools
Comparing version 2.0.7 to 2.0.8
@@ -1,2 +0,2 @@ | ||
var Listener=function(s){"use strict";const v="2.0.7",e={},f=o=>{const{type:i,currentTarget:c}=o;e[i].forEach((r,t)=>{c===t&&r.forEach((n,a)=>{a.apply(t,[o]),typeof n=="object"&&n.once&&d(t,i,a,n)})})},g=(o,i,c,r)=>{e[i]||(e[i]=new Map);const t=e[i];t.has(o)||t.set(o,new Map);const n=t.get(o),{size:a}=n;n.set(c,r),a||o.addEventListener(i,f,r)},d=(o,i,c,r)=>{const t=e[i],n=t&&t.get(o),a=n&&n.get(c),M=a!==void 0?a:r;n&&n.has(c)&&n.delete(c),t&&(!n||!n.size)&&t.delete(o),(!t||!t.size)&&delete e[i],(!n||!n.size)&&o.removeEventListener(i,f,M)},L=g,E=d;return s.addListener=g,s.globalListener=f,s.off=E,s.on=L,s.registry=e,s.removeListener=d,s.version=v,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),s}({}); | ||
var Listener=function(s){"use strict";const v="2.0.8",e={},f=o=>{const{type:i,currentTarget:c}=o;e[i].forEach((r,t)=>{c===t&&r.forEach((n,a)=>{a.apply(t,[o]),typeof n=="object"&&n.once&&d(t,i,a,n)})})},g=(o,i,c,r)=>{e[i]||(e[i]=new Map);const t=e[i];t.has(o)||t.set(o,new Map);const n=t.get(o),{size:a}=n;n.set(c,r),a||o.addEventListener(i,f,r)},d=(o,i,c,r)=>{const t=e[i],n=t&&t.get(o),a=n&&n.get(c),M=a!==void 0?a:r;n&&n.has(c)&&n.delete(c),t&&(!n||!n.size)&&t.delete(o),(!t||!t.size)&&delete e[i],(!n||!n.size)&&o.removeEventListener(i,f,M)},L=g,E=d;return s.addListener=g,s.globalListener=f,s.off=E,s.on=L,s.registry=e,s.removeListener=d,s.version=v,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),s}({}); | ||
//# sourceMappingURL=event-listener.js.map |
{ | ||
"name": "@thednp/event-listener", | ||
"author": "thednp", | ||
"version": "2.0.7", | ||
"description": "Modern event listener for efficient web applications based on subscribe-publish pattern.", | ||
"version": "2.0.8", | ||
"description": "🚅 Modern event listener for efficient web applications based on subscribe-publish pattern.", | ||
"license": "MIT", | ||
@@ -7,0 +7,0 @@ "homepage": "https://thednp.github.io/event-listener", |
@@ -12,3 +12,3 @@ ## EventListener | ||
A TypeScript sourced event listener for efficient applications based on the [subscribe-publish](https://hackernoon.com/do-you-still-register-window-event-listeners-in-each-component-react-in-example-31a4b1f6f1c8) pattern, less than 900 bytes when minified and packs a surprising amount of power. | ||
A TypeScript sourced event listener for efficient applications based on the [subscribe-publish](https://hackernoon.com/do-you-still-register-window-event-listeners-in-each-component-react-in-example-31a4b1f6f1c8) pattern, around 700 bytes when minified and packs a surprising amount of power. | ||
@@ -23,8 +23,22 @@ ## Features | ||
# Install | ||
```bash | ||
pnpm install -D @thednp/event-listener | ||
``` | ||
npm i @thednp/event-listener | ||
```bash | ||
yarn add -D @thednp/event-listener | ||
``` | ||
```bash | ||
npm install -D @thednp/event-listener | ||
``` | ||
```bash | ||
deno install -D npm:@thednp/event-listener@latest | ||
``` | ||
## CDN | ||
@@ -73,3 +87,3 @@ | ||
Map(1) { | ||
Entries(Array) => [ | ||
Entries => [ | ||
0: { | ||
@@ -81,3 +95,3 @@ key: handleMyClick() // listener | ||
size: 1, // size of the Map | ||
prototype: [Prototype(Object)] | ||
prototype: [Prototype(Map)] | ||
} | ||
@@ -108,3 +122,3 @@ | ||
```js | ||
```ts | ||
import { on, FocusEventHandler } from '@thednp/event-listener'; | ||
@@ -128,3 +142,3 @@ | ||
- run `npm install` or `npm update`, takes a few minutes to download the Electron browser; | ||
- run `npm run cypress` to open the Cypress console OR `npm run test` to run the tests in headless mode. | ||
- run `npm run test-ui` to open the browser mode testing OR `npm run test` to run the tests in headless mode. | ||
@@ -131,0 +145,0 @@ ## License |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
142
0
42244
12