Gathering detailed insights and metrics for @khmyznikov/pwa-install
Gathering detailed insights and metrics for @khmyznikov/pwa-install
Gathering detailed insights and metrics for @khmyznikov/pwa-install
Gathering detailed insights and metrics for @khmyznikov/pwa-install
npm install @khmyznikov/pwa-install
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
395 Stars
336 Commits
62 Forks
7 Watching
3 Branches
25 Contributors
Updated on 27 Nov 2024
Minified
Minified + Gzipped
TypeScript (59.07%)
SCSS (31.45%)
JavaScript (9.48%)
Cumulative downloads
Total Downloads
Last day
120.5%
7,912
Compared to previous day
Last week
10.2%
31,969
Compared to previous week
Last month
1.1%
130,096
Compared to previous month
Last year
4,053.5%
769,939
Compared to previous year
26
New to PWAs? Unsure how to create a Web App? Check out these resources for a quick start: PWA Intro, PWA Starter, PWA Builder
Installation dialog for Progressive Web Application (PWA) and Add to Home Screen/Dock dialog for Web Apps. This offers an enhanced user experience and addresses the absence of native dialogs in certain browsers. 20kB brotli compressed bundle. Translation/localization is supported.
Use it as Web Component with any modern framework. No polyfill is required.
⚡Should work with any other modern framework or just vanila js as web component.
iOS default | Install instruction | App gallery |
---|---|---|
MacOS 14+ (Sonoma) | Install instruction |
---|---|
iPadOS |
---|
Android | App gallery | Light theme |
---|---|---|
Chrome | App Gallery |
---|---|
1npm i @khmyznikov/pwa-install
Alternatively, you can use unpkg or esm.sh.
1import '@khmyznikov/pwa-install';
1"compilerOptions": { 2 "moduleResolution": "Bundler", 3 "types": ["dom-chromium-installation-events", "web-app-manifest"] 4}
1<pwa-install></pwa-install>
1<pwa-install 2 manual-apple="true" 3 manual-chrome="true" 4 disable-chrome="true" 5 disable-close="true" 6 use-local-storage="true" 7 8 install-description="Custom call to install text" 9 disable-install-description="true" 10 disable-screenshots="true" 11 disable-screenshots-apple="true" 12 disable-screenshots-chrome="true" 13 14 manifest-url="/manifest.json" 15 name="PWA" 16 description="Progressive web application" 17 icon="/icon.png"> 18</pwa-install> 19<!-- 20 manual-apple/chrome params means you want to show the Dialog manually by showDialog(). 21 disable-chrome param is for completely disabling custom logic and interception for Chromium browsers (will work built-in browser logic). 22 use-local-storage will store the user's preference to ignore the prompt in long-lived storage (so they will not be prompted again unless they clear application data) 23--->
Make a good manifest file and don't use name/descr/icon params. Boolean attributes needs to be removed to act like "false"
1<script type="text/javascript"> 2 var pwaInstall = document.getElementsByTagName('pwa-install')[0]; 3 4 pwaInstall.addEventListener('pwa-install-success-event', (event) => {console.log(event.detail.message)}); 5</script>
⚠️ success/fail/choice events is Chromium only, iOS don't have them.
1<script type="text/javascript"> 2 var pwaInstall = document.getElementsByTagName('pwa-install')[0]; 3 4 console.log(pwaInstall.isUnderStandaloneMode); 5</script>
1<script type="text/javascript"> 2 var pwaInstall = document.getElementsByTagName('pwa-install')[0]; 3 4 pwaInstall.install(); 5</script>
getInstalledRelatedApps is Chromium only, always empty on iOS.
If you need to target Chromium browsers but you want to postpone component mounting, you can do it! But, need to capture beforeinstallprompt manually and pass it to the component's externalPromptEvent property(not attribute).
1// capture event asap, better right in index.html script tag 2window.addEventListener('beforeinstallprompt', (e) => { 3 e.preventDefault(); 4 e.stopPropagation(); 5 e.stopImmediatePropagation(); 6 7 // save it somewhere 8 window.promptEvent = e; 9}); 10 11// later render the component on demand and pass event 12document.getElementById("pwa-install").externalPromptEvent = window.promptEvent;
Translations available:
Language should change automatically based on browser settings. Please create the pull-request if you want to help with translation to your language. It's an easy process.
Patrick Voigt
Darren Debono
Angelo Fan
Chris Cherniakov
Leek Duck
No vulnerabilities found.
Reason
30 commit(s) and 13 issue activity found in the last 90 days -- score normalized to 10
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 7/14 approved changesets -- score normalized to 5
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More