File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 65
65
</ header >
66
66
< iframe id ="wp "> </ iframe >
67
67
< script type ="module " async >
68
+ const slug = "{{PWA_SLUG}}" ;
69
+
68
70
/**
69
71
* Install PWA button
70
72
*/
75
77
window . addEventListener ( "beforeinstallprompt" , ( event ) => {
76
78
event . preventDefault ( ) ;
77
79
installPrompt = event ;
78
- showInstallHeader ( ) ;
80
+ if ( localStorage . getItem ( `hide-install-header-for-${ slug } ` ) === 'true' ) {
81
+ hideInstallHeader ( ) ;
82
+ } else {
83
+ showInstallHeader ( ) ;
84
+ }
79
85
} ) ;
80
86
installButton . addEventListener ( "click" , async ( ) => {
81
87
if ( ! installPrompt ) {
86
92
hideInstallHeader ( ) ;
87
93
} ) ;
88
94
closeInstallButton . addEventListener ( "click" , ( ) => {
95
+ localStorage . setItem ( `hide-install-header-for-${ slug } ` , 'true' ) ;
89
96
hideInstallHeader ( ) ;
90
97
} ) ;
91
98
function hideInstallHeader ( ) {
97
104
98
105
// Boot Playground
99
106
import { startPlaygroundWeb } from "https://playground.wordpress.net/client/index.js" ;
100
- const slug = "{{PWA_SLUG}}" ;
101
107
102
108
function isWordPressInstalled ( slug ) {
103
109
return localStorage . getItem ( `wordpress-installed-for-${ slug } ` ) === 'true' ;
You can’t perform that action at this time.
0 commit comments