@iroomit/page-interaction-listener
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -7,3 +7,3 @@ /** | ||
* First Created: September 29, 2022 | ||
* Last Edited: November 14, 2022 | ||
* Last Edited: April 3, 2023 | ||
@@ -29,6 +29,6 @@ * This source code is licensed under the MIT license found in the | ||
declare function removeListener(func: Function | Array<Function>): void; | ||
declare const _default: { | ||
declare const PageInteractionListener: { | ||
addListener: typeof addListener; | ||
removeListener: typeof removeListener; | ||
}; | ||
export default _default; | ||
export default PageInteractionListener; |
@@ -8,3 +8,3 @@ "use strict"; | ||
* First Created: September 29, 2022 | ||
* Last Edited: November 14, 2022 | ||
* Last Edited: April 3, 2023 | ||
@@ -15,3 +15,2 @@ * This source code is licensed under the MIT license found in the | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
// Store the listener functions added by the user | ||
@@ -96,4 +95,3 @@ const _listeners = []; | ||
} | ||
// Make sure we're in a browser before adding the listeners | ||
// Make sure we're in a browser before adding our Main listener | ||
// Makes safe for SSR with Next.js, Gatsby etc. | ||
@@ -108,6 +106,6 @@ if (typeof window !== 'undefined') { | ||
} | ||
exports.default = { | ||
const PageInteractionListener = { | ||
addListener, | ||
removeListener | ||
}; | ||
exports.default = PageInteractionListener; |
{ | ||
"name": "@iroomit/page-interaction-listener", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"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.", | ||
"main": "lib/index.js", | ||
"main": "lib/index.min.js", | ||
"types": "lib/index.d.ts", | ||
"scripts": { | ||
"build": "npx tsc" | ||
"build": "npx tsc && npx minify ./lib/index.js > ./lib/index.min.js" | ||
}, | ||
@@ -31,4 +31,4 @@ "repository": { | ||
"devDependencies": { | ||
"typescript": "^4.8.4" | ||
"typescript": "^5.0.3" | ||
} | ||
} |
@@ -5,4 +5,10 @@ # Page Interaction Listener (@iroomit/page-interaction-listener) | ||
This can be used to lazy-load libraries and delay code that is not needed until the user has interacted with the page (UI code below the fold, UX libraries, etc). This can reduce bundle size, improve initial page load time as well as the end-user experience as a result. | ||
This can be used to lazy-load libraries and delay code that is not needed until the user has interacted with the page (UI code below the fold, UX libraries, analytics libraries, etc). This can reduce bundle size, improve initial page load time as well as the end-user experience as a result. Ultimately this will help with SEO (Search Engine Optimization). | ||
✅ No additional libraries/imports (Pure JS) | ||
✅ Small minified bundle size (< 2KB) | ||
✅ Implemented in TypeScript/Full TypeScript Support | ||
Compatible with any modern browser as it uses the native browser document events under the hood. Can be used with any major JavaScript/TypeScript library ([React](https://reactjs.org/), [Angular](https://angular.io/), [Vue](https://vuejs.org/)). SSR friendly for [Next.js](https://nextjs.org/), [Gatsby](https://www.gatsbyjs.com/), etc. | ||
@@ -9,0 +15,0 @@ |
@@ -7,3 +7,3 @@ /** | ||
* First Created: September 29, 2022 | ||
* Last Edited: November 14, 2022 | ||
* Last Edited: April 3, 2023 | ||
@@ -116,5 +116,7 @@ * This source code is licensed under the MIT license found in the | ||
export default { | ||
const PageInteractionListener = { | ||
addListener, | ||
removeListener | ||
}; | ||
}; | ||
export default PageInteractionListener; |
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
28398
8
335
91