1. beforeinstallprompt 액션에서 deferedPrompt 변수에 evnet 할당
window.addEventListener('beforeinstallprompt', function(event) {
console.log('beforeinstallprompt fired');
event.preventDefault();
deferredPrompt = event;
return false;
});
2. banner show
function showBanner() {
if (deferredPrompt) {
deferredPrompt.prompt();
deferredPrompt.userChoice.then(function(choiceResult) {
console.log(choiceResult.outcome);
if (choiceResult.outcome === 'dismissed') {
console.log('User cancelled installation');
} else {
console.log('User added to home screen');
}
});
deferredPrompt = null;
}
}