Ver código fonte

fix: don't display install banner when installed

Remy Sharp 9 anos atrás
pai
commit
a43c7fa7ab
1 arquivos alterados com 8 adições e 0 exclusões
  1. 8 0
      app/scripts/app.js

+ 8 - 0
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) {