OLD | NEW |
---|---|
(Empty) | |
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. | |
4 | |
5 var port = null; | |
6 this.onsync = function(e) { | |
7 if (port) { | |
8 e.waitUntil(new Promise(function(resolve) { | |
Devlin
2015/11/16 18:12:41
Maybe I'm missing something - when does this resol
lazyboy
2015/11/16 19:30:16
It never did. Fixed.
| |
9 // Add a small delay to respond so we can exercise and test the | |
10 // offline->online transition. | |
Devlin
2015/11/16 18:12:41
"small delays" usually correspond to flakiness. I
lazyboy
2015/11/16 19:30:16
We don't really need it, but this might catch some
| |
11 setTimeout(function() { | |
12 port.postMessage('SYNC: ' + e.registration.tag); | |
13 }, 5); | |
14 })); | |
15 } | |
16 }; | |
17 | |
18 this.onmessage = function(e) { | |
19 port = e.ports[0]; | |
20 }; | |
OLD | NEW |