250x250
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 애니메이션
- hover
- 자바스크립트
- javascript
- Animation
- 백엔드
- ipad
- css3
- HTML
- IOS
- 비전공 개발자
- MAC
- 개발자
- iOS 개발자
- front-end
- SWIFT
- xcode
- html5
- 프론트엔드
- CSS
- react
- effect
- php
- iPhone
- image
- keyframes
- jQuery
- button
- 비전공자
- 풀스택
Archives
- Today
- Total
비전공자 개발일기
PWA Install Ready 본문
728x90
SMALL
PWA를 설치할 수 있음을 표시하고 사용자 지정 인앱 설치 흐름을 제공하는 방법
- beforeinstallprompt 이벤트 실행
// Initialize deferredPrompt for use later to show browser install prompt.
let deferredPrompt;
window.addEventListener('beforeinstallprompt', (e) => {
// Prevent the mini-infobar from appearing on mobile
e.preventDefault();
// Stash the event so it can be triggered later.
deferredPrompt = e;
// Update UI notify the user they can install the PWA
showInstallPromotion();
// Optionally, send analytics event that PWA install promo was shown.
console.log(`'beforeinstallprompt' event was fired.`);
});
2. 인앱 설치 흐름
buttonInstall.addEventListener('click', async () => {
// Hide the app provided install promotion
hideInstallPromotion();
// Show the install prompt
deferredPrompt.prompt();
// Wait for the user to respond to the prompt
const { outcome } = await deferredPrompt.userChoice;
// Optionally, send analytics event with outcome of user choice
console.log(`User response to the install prompt: ${outcome}`);
// We've used the prompt, and can't use it again, throw it away
deferredPrompt = null;
});
자신만의 인앱 설치 경험을 제공하는 방법
beforeinstallprompt 이벤트를 사용하여 사용자에게 원활한 맞춤형 인앱 설치 환경을 제공하십시오.
web.dev
728x90
LIST
'기타' 카테고리의 다른 글
Pynecone (0) | 2023.01.15 |
---|---|
IPhone Toggle Switch (0) | 2022.04.10 |
모바일 웹 페이지 바로가기 아이콘 등록 (0) | 2022.04.06 |
MacBook M1에서 Homebrew 설치 + unknown command cask 문제 (0) | 2022.01.22 |
Mac Book 유용한 단축키 (0) | 2022.01.16 |