@iroomit/page-interaction-listener
Advanced tools
Comparing version 1.1.0 to 1.1.1
{ | ||
"name": "@iroomit/page-interaction-listener", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Takes a function (or several functions) as an argument and only executes them once the user has interacted with the page via mouse, keyboard or touch.", | ||
@@ -8,3 +8,4 @@ "main": "lib/index.min.js", | ||
"scripts": { | ||
"build": "npx tsc && npx minify ./lib/index.js > ./lib/index.min.js" | ||
"build": "npx tsc && npx minify ./lib/index.js > ./lib/index.min.js", | ||
"test": "yarn build && jest" | ||
}, | ||
@@ -32,4 +33,13 @@ "repository": { | ||
"devDependencies": { | ||
"@babel/core": "^7.22.5", | ||
"@babel/preset-env": "^7.22.5", | ||
"@babel/preset-typescript": "^7.22.5", | ||
"@jest/globals": "^29.5.0", | ||
"babel-jest": "^29.5.0", | ||
"jest": "^29.5.0", | ||
"jest-environment-jsdom": "^29.5.0", | ||
"ts-jest": "^29.1.0", | ||
"ts-node": "^10.9.1", | ||
"typescript": "^5.0.3" | ||
} | ||
} |
# Page Interaction Listener (@iroomit/page-interaction-listener) | ||
[![License: MIT](https://img.shields.io/badge/License-MIT-brightgreen.svg)](https://opensource.org/licenses/MPL-2.0) | ||
![Version](https://img.shields.io/badge/Version-1.1.1-blue) | ||
The purpose of this package is to easily delay code from running in the browser until the user has interacted with the page in some way (mouse-over, click, touch, scroll or keypress). | ||
@@ -4,0 +7,0 @@ |
@@ -32,7 +32,7 @@ /** | ||
if (func instanceof Array<Function>) { // if it's an array, add all the functions to listeners variable | ||
if (Array.isArray(func)) { // if it's an array, add all the functions to listeners variable | ||
for (var i: number = 0; i < func.length; i++) { | ||
_listeners.push(func[i]); | ||
} | ||
} else if (func instanceof Function) { // otherwise, push the function | ||
} else if (typeof func === 'function') { // otherwise, push the function | ||
_listeners.push(func); | ||
@@ -56,3 +56,3 @@ } | ||
if (func instanceof Array<Function>) { // if it's an array, remove all the functions found in listeners variable | ||
if (Array.isArray(func)) { // if it's an array, remove all the functions found in listeners variable | ||
for (var i: number = 0; i < func.length; i++) { | ||
@@ -67,3 +67,3 @@ let foundIndex: number = _listeners.indexOf(func[i]); | ||
} | ||
} else if (func instanceof Function) { // otherwise, remove the single function if found | ||
} else if (typeof func === 'function') { // otherwise, remove the single function if found | ||
let foundIndex: number = _listeners.indexOf(func); | ||
@@ -70,0 +70,0 @@ |
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
44560
17
697
94
10