From a43c7fa7abea3daca0886ce8b9254b7a36b16600 Mon Sep 17 00:00:00 2001 From: Remy Sharp Date: Wed, 18 May 2016 13:12:55 +0100 Subject: [PATCH] fix: don't display install banner when installed --- app/scripts/app.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/scripts/app.js b/app/scripts/app.js index 627fd5b..b34034f 100644 --- a/app/scripts/app.js +++ b/app/scripts/app.js @@ -14,6 +14,14 @@ // app.baseUrl = '/polymer-starter-kit/'; } + // don't display the install prompt if the user has *already* installed + window.addEventListener('beforeinstallprompt', function(event) { + if (window.matchMedia('(display-mode: standalone)').matches) { + return event.preventDefault(); + } + }); + + app.displayInstalledToast = function() { // Check to make sure caching is actually enabled—it won't be in the dev environment. if (!Polymer.dom(document).querySelector('platinum-sw-cache').disabled) {