@solid-primitives/event-listener
Advanced tools
Comparing version 2.2.8 to 2.2.9
import { tryOnCleanup, entries, createCallbackStack, asArray, access, keys } from '@solid-primitives/utils'; | ||
import { createEffect, createRenderEffect, createSignal, onCleanup } from 'solid-js'; | ||
import { isServer } from 'solid-js/web'; | ||
@@ -10,2 +11,4 @@ // src/eventListener.ts | ||
function createEventListener(targets, type, handler, options) { | ||
if (isServer) | ||
return; | ||
const attachListeners = () => { | ||
@@ -23,2 +26,5 @@ asArray(access(targets)).forEach((el) => { | ||
function createEventSignal(target, type, options) { | ||
if (isServer) { | ||
return () => void 0; | ||
} | ||
const [lastEvent, setLastEvent] = createSignal(); | ||
@@ -35,2 +41,5 @@ createEventListener(target, type, setLastEvent, options); | ||
function createEventListenerMap(targets, handlersMap, options) { | ||
if (isServer) { | ||
return; | ||
} | ||
for (const [eventName, handler] of entries(handlersMap)) { | ||
@@ -48,8 +57,15 @@ if (handler) | ||
var WindowEventListener = (props) => { | ||
if (isServer) | ||
return null; | ||
attachPropListeners(window, props); | ||
}; | ||
var DocumentEventListener = (props) => { | ||
if (isServer) | ||
return null; | ||
attachPropListeners(document, props); | ||
}; | ||
function makeEventListenerStack(target, options) { | ||
if (isServer) { | ||
return [() => () => void 0, () => void 0]; | ||
} | ||
const { push, execute } = createCallbackStack(); | ||
@@ -56,0 +72,0 @@ return [ |
{ | ||
"name": "@solid-primitives/event-listener", | ||
"version": "2.2.8", | ||
"version": "2.2.9", | ||
"description": "SolidJS Primitives to manage creating event listeners.", | ||
@@ -33,38 +33,7 @@ "author": "David Di Biase <dave.dibiase@gmail.com>", | ||
"type": "module", | ||
"main": "./dist/server.cjs", | ||
"module": "./dist/server.js", | ||
"browser": { | ||
"./dist/server.js": "./dist/index.js", | ||
"./dist/server.cjs": "./dist/index.cjs" | ||
}, | ||
"main": "./dist/index.cjs", | ||
"module": "./dist/index.js", | ||
"browser": {}, | ||
"types": "./dist/index.d.ts", | ||
"exports": { | ||
"worker": { | ||
"import": { | ||
"types": "./dist/index.d.ts", | ||
"default": "./dist/server.js" | ||
}, | ||
"require": "./dist/server.cjs" | ||
}, | ||
"browser": { | ||
"import": { | ||
"types": "./dist/index.d.ts", | ||
"default": "./dist/index.js" | ||
}, | ||
"require": "./dist/index.cjs" | ||
}, | ||
"deno": { | ||
"import": { | ||
"types": "./dist/index.d.ts", | ||
"default": "./dist/server.js" | ||
}, | ||
"require": "./dist/server.cjs" | ||
}, | ||
"node": { | ||
"import": { | ||
"types": "./dist/index.d.ts", | ||
"default": "./dist/server.js" | ||
}, | ||
"require": "./dist/server.cjs" | ||
}, | ||
"import": { | ||
@@ -83,6 +52,6 @@ "types": "./dist/index.d.ts", | ||
"dependencies": { | ||
"@solid-primitives/utils": "^5.4.0" | ||
"@solid-primitives/utils": "^5.5.1" | ||
}, | ||
"peerDependencies": { | ||
"solid-js": "^1.6.0" | ||
"solid-js": "^1.6.12" | ||
}, | ||
@@ -94,3 +63,3 @@ "typesVersions": {}, | ||
"page": "vite build dev", | ||
"build": "jiti ../../scripts/build.ts --ssr", | ||
"build": "jiti ../../scripts/build.ts", | ||
"test": "vitest -c ../../configs/vitest.config.ts", | ||
@@ -97,0 +66,0 @@ "test:ssr": "pnpm run test --mode ssr" |
Sorry, the diff of this file is not supported yet
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
29170
6
381