@solid-primitives/idle
Advanced tools
Comparing version 0.0.101 to 0.0.102
@@ -23,3 +23,3 @@ import { Accessor } from 'solid-js'; | ||
/** | ||
* A primiive to observe the user's idle state and react to its changes. | ||
* A primitive to observe the user's idle state and react to its changes. | ||
* @param - an objects that takes several variables and callbacks, all of them optionals | ||
@@ -26,0 +26,0 @@ * { |
@@ -0,3 +1,4 @@ | ||
import { createSignal, onMount, onCleanup, batch } from 'solid-js'; | ||
// src/createIdleTimer.ts | ||
import { batch, createSignal, onMount, onCleanup } from "solid-js"; | ||
var THROTTLE_DELAY = 250; | ||
@@ -126,4 +127,3 @@ var FIFTEEN_MINUTES = 9e5; | ||
}; | ||
export { | ||
createIdleTimer | ||
}; | ||
export { createIdleTimer }; |
@@ -1,14 +0,41 @@ | ||
// src/server.ts | ||
var createIdleTimer = (v) => ({ | ||
isIdle: () => false, | ||
isPrompted: () => false, | ||
reset: () => { | ||
}, | ||
start: () => { | ||
}, | ||
stop: () => { | ||
import 'solid-js'; | ||
// src/createIdleTimer.ts | ||
var FIFTEEN_MINUTES = 9e5; | ||
var EVENTS = [ | ||
"mousemove", | ||
"keydown", | ||
"wheel", | ||
"resize", | ||
"wheel", | ||
"mousedown", | ||
"pointerdown", | ||
"touchstart", | ||
"touchmove", | ||
"visibilitychange" | ||
]; | ||
var createIdleTimer = ({ | ||
element, | ||
events = EVENTS, | ||
idleTimeout = FIFTEEN_MINUTES, | ||
promptTimeout = 0, | ||
onActive, | ||
onIdle, | ||
onPrompt, | ||
startManually = false | ||
} = {}) => { | ||
{ | ||
return { | ||
isIdle: () => false, | ||
isPrompted: () => false, | ||
reset: () => { | ||
}, | ||
start: () => { | ||
}, | ||
stop: () => { | ||
} | ||
}; | ||
} | ||
}); | ||
export { | ||
createIdleTimer | ||
}; | ||
export { createIdleTimer }; |
{ | ||
"name": "@solid-primitives/idle", | ||
"version": "0.0.101", | ||
"version": "0.0.102", | ||
"description": "A primitive to observe the user's idle status and react to its changes.", | ||
@@ -26,10 +26,30 @@ "author": "Aylo Srd <aylo.srd@gmail.com>", | ||
"sideEffects": false, | ||
"type": "module", | ||
"files": [ | ||
"dist" | ||
], | ||
"type": "module", | ||
"main": "./dist/server.cjs", | ||
"module": "./dist/index.js", | ||
"module": "./dist/server.js", | ||
"browser": { | ||
"./dist/server.cjs": "./dist/index.cjs", | ||
"./dist/server.js": "./dist/index.js" | ||
}, | ||
"types": "./dist/index.d.ts", | ||
"exports": { | ||
"worker": { | ||
"import": "./dist/server.js", | ||
"require": "./dist/server.cjs" | ||
}, | ||
"browser": { | ||
"development": { | ||
"import": "./dist/dev.js", | ||
"require": "./dist/dev.cjs" | ||
}, | ||
"import": "./dist/index.js", | ||
"require": "./dist/index.cjs" | ||
}, | ||
"deno": { | ||
"import": "./dist/server.js", | ||
"require": "./dist/server.cjs" | ||
}, | ||
"node": { | ||
@@ -39,2 +59,6 @@ "import": "./dist/server.js", | ||
}, | ||
"development": { | ||
"import": "./dist/dev.js", | ||
"require": "./dist/dev.cjs" | ||
}, | ||
"import": "./dist/index.js", | ||
@@ -53,6 +77,5 @@ "require": "./dist/index.cjs" | ||
"prettier": "^2.7.1", | ||
"solid-js": "^1.5.4", | ||
"solid-js": "^1.5.0", | ||
"tslib": "^2.4.0", | ||
"tsup": "^6.2.3", | ||
"typescript": "^4.8.2", | ||
"unocss": "^0.45.15", | ||
@@ -64,3 +87,3 @@ "vite": "^3.0.9", | ||
"peerDependencies": { | ||
"solid-js": "^1.4.0" | ||
"solid-js": "^1.5.0" | ||
}, | ||
@@ -70,5 +93,6 @@ "scripts": { | ||
"dev": "npm run start", | ||
"build": "tsup", | ||
"test": "vitest" | ||
"build": "jiti ../../scripts/build.ts --ssr --dev", | ||
"test": "vitest -c ../../configs/vitest.config.ts", | ||
"test:ssr": "pnpm run test --mode ssr" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
24871
9
10
632