OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 cr.define('serviceworker', function() { | 5 cr.define('serviceworker', function() { |
6 'use strict'; | 6 'use strict'; |
7 | 7 |
8 function initialize() { | 8 function initialize() { |
9 update(); | 9 update(); |
10 } | 10 } |
(...skipping 24 matching lines...) Expand all Loading... |
35 inputs[i].hasClickEvent = true; | 35 inputs[i].hasClickEvent = true; |
36 } | 36 } |
37 } | 37 } |
38 } | 38 } |
39 | 39 |
40 function progressNodeFor(link) { | 40 function progressNodeFor(link) { |
41 return link.parentNode.querySelector('.operation-status'); | 41 return link.parentNode.querySelector('.operation-status'); |
42 } | 42 } |
43 | 43 |
44 // All commands are completed with 'onOperationComplete'. | 44 // All commands are completed with 'onOperationComplete'. |
45 var COMMANDS = ['stop', 'push', 'inspect', 'unregister', 'start']; | 45 var COMMANDS = ['stop', 'inspect', 'unregister', 'start']; |
46 function commandHandler(command) { | 46 function commandHandler(command) { |
47 return function(event) { | 47 return function(event) { |
48 var link = event.target; | 48 var link = event.target; |
49 progressNodeFor(link).style.display = 'inline'; | 49 progressNodeFor(link).style.display = 'inline'; |
50 sendCommand(command, link.cmdArgs, (function(status) { | 50 sendCommand(command, link.cmdArgs, (function(status) { |
51 progressNodeFor(link).style.display = 'none'; | 51 progressNodeFor(link).style.display = 'none'; |
52 }).bind(null, link)); | 52 }).bind(null, link)); |
53 return false; | 53 return false; |
54 }; | 54 }; |
55 }; | 55 }; |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 onRunningStateChanged: onRunningStateChanged, | 257 onRunningStateChanged: onRunningStateChanged, |
258 onErrorReported: onErrorReported, | 258 onErrorReported: onErrorReported, |
259 onConsoleMessageReported: onConsoleMessageReported, | 259 onConsoleMessageReported: onConsoleMessageReported, |
260 onVersionStateChanged: onVersionStateChanged, | 260 onVersionStateChanged: onVersionStateChanged, |
261 onRegistrationStored: onRegistrationStored, | 261 onRegistrationStored: onRegistrationStored, |
262 onRegistrationDeleted: onRegistrationDeleted, | 262 onRegistrationDeleted: onRegistrationDeleted, |
263 }; | 263 }; |
264 }); | 264 }); |
265 | 265 |
266 document.addEventListener('DOMContentLoaded', serviceworker.initialize); | 266 document.addEventListener('DOMContentLoaded', serviceworker.initialize); |
OLD | NEW |