File tree Expand file tree Collapse file tree 5 files changed +29
-4
lines changed
elements/cr-search-control Expand file tree Collapse file tree 5 files changed +29
-4
lines changed Original file line number Diff line number Diff line change 44
44
}
45
45
</ style >
46
46
< iron-ajax id ="ajax "
47
- auto
48
47
url ="{{protocolSrc}} "
49
48
handle-as ="json "
50
49
active-requests ="{{requests}} "
133
132
] ,
134
133
properties : {
135
134
protocolSrc : {
136
- value : String
135
+ value : String ,
136
+ observer : 'fireAjax_'
137
137
} ,
138
138
inputActive : {
139
139
type : Boolean ,
210
210
}
211
211
} ,
212
212
213
+ fireAjax_ : function ( ) {
214
+ if ( this . protocolSrc ) {
215
+ this . $ . ajax . generateRequest ( ) ;
216
+ }
217
+ } ,
218
+
213
219
handleButtonActiveChange_ : function ( ) {
214
220
this . inputActive = this . $ . searchButton . active ;
215
221
} ,
Original file line number Diff line number Diff line change @@ -132,11 +132,24 @@ function build() {
132
132
. then ( ( ) => {
133
133
// Okay, now let's generate the Service Worker
134
134
console . log ( 'Generating the Service Worker...' ) ;
135
+ const staticFileGlobs = [
136
+ polymerJson . entrypoint ,
137
+ polymerJson . shell ,
138
+ ] . concat ( polymerJson . extraDependencies )
139
+ . concat ( polymerJson . sources )
140
+ // Statikk can not handle `.nojekyll` requests
141
+ // Nonetheless, this file is only required to exist, so
142
+ // we can just ignore it for caching.
143
+ . filter ( e => e !== '.nojekyll' ) ;
144
+
135
145
return polymerBuild . addServiceWorker ( {
136
146
project : polymerProject ,
137
147
buildRoot : buildDirectory ,
138
148
bundled : true ,
139
- swPrecacheConfig : swPrecacheConfig
149
+ swPrecacheConfig : {
150
+ staticFileGlobs,
151
+ navigateFallback : polymerJson . entrypoint
152
+ }
140
153
} ) ;
141
154
} )
142
155
. then ( ( ) => {
Original file line number Diff line number Diff line change @@ -511,6 +511,10 @@ <h4 id="simultaneous">Does the protocol support multiple simultaneous clients?</
511
511
toolbar . classList . remove ( 'search-active' ) ;
512
512
} , false ) ;
513
513
} ) ;
514
+
515
+ if ( 'serviceWorker' in window . navigator ) {
516
+ navigator . serviceWorker . register ( 'service-worker.js' ) ;
517
+ }
514
518
} ) ( ) ;
515
519
</ script >
516
520
< script >
Original file line number Diff line number Diff line change 12
12
" _data/**/*" ,
13
13
" _versions/**/*" ,
14
14
" search_index/**/*" ,
15
- " bower_components/webcomponentsjs/*.js"
15
+ " bower_components/webcomponentsjs/*.js" ,
16
+ " bower_components/web-animations-js/web-animations-next.min.js"
16
17
],
17
18
"lint" : {
18
19
"rules" : [" polymer-2" ]
Original file line number Diff line number Diff line change
1
+ console . log ( 'ServiceWorker disabled in development mode.' ) ;
You can’t perform that action at this time.
0 commit comments