1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
8 function waitUntilActivated() {
9 if (registration
&& registration
.active
) {
10 window
.location
= "#sw_activated";
11 window
.clearInterval(interval
);
13 console
.log("SW not yet active.");
17 function initialize() {
18 navigator
.serviceWorker
.register('service_worker.js')
22 interval
= window
.setInterval(function() {waitUntilActivated()}, 50);