Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/persistence/PersistenceUtils.js

Issue 2533483002: [DevTools] Typed events and event listeners. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 Persistence.PersistenceUtils = class { 5 Persistence.PersistenceUtils = class {
6 /** 6 /**
7 * @param {!Workspace.UISourceCode} uiSourceCode 7 * @param {!Workspace.UISourceCode} uiSourceCode
8 * @return {string} 8 * @return {string}
9 */ 9 */
10 static tooltipForUISourceCode(uiSourceCode) { 10 static tooltipForUISourceCode(uiSourceCode) {
(...skipping 11 matching lines...) Expand all
22 /** 22 /**
23 * @extends {Common.Object} 23 * @extends {Common.Object}
24 * @implements {Components.LinkDecorator} 24 * @implements {Components.LinkDecorator}
25 */ 25 */
26 Persistence.PersistenceUtils.LinkDecorator = class extends Common.Object { 26 Persistence.PersistenceUtils.LinkDecorator = class extends Common.Object {
27 /** 27 /**
28 * @param {!Persistence.Persistence} persistence 28 * @param {!Persistence.Persistence} persistence
29 */ 29 */
30 constructor(persistence) { 30 constructor(persistence) {
31 super(); 31 super();
32 persistence.addEventListener(Persistence.Persistence.Events.BindingCreated, this._bindingChanged, this); 32 persistence.addEventListener(Persistence.Persistence.BindingChangedEvent, th is._bindingChanged, this);
33 persistence.addEventListener(Persistence.Persistence.Events.BindingRemoved, this._bindingChanged, this);
34 } 33 }
35 34
36 /** 35 /**
37 * @param {!Common.Event} event 36 * @param {!Persistence.Persistence.BindingChangedEvent} event
38 */ 37 */
39 _bindingChanged(event) { 38 _bindingChanged(event) {
40 var binding = /** @type {!Persistence.PersistenceBinding} */ (event.data); 39 this.dispatchEventToListeners(Components.LinkDecorator.Events.LinkIconChange d, event.binding.network);
41 this.dispatchEventToListeners(Components.LinkDecorator.Events.LinkIconChange d, binding.network);
42 } 40 }
43 41
44 /** 42 /**
45 * @override 43 * @override
46 * @param {!Workspace.UISourceCode} uiSourceCode 44 * @param {!Workspace.UISourceCode} uiSourceCode
47 * @return {?UI.Icon} 45 * @return {?UI.Icon}
48 */ 46 */
49 linkIcon(uiSourceCode) { 47 linkIcon(uiSourceCode) {
50 var binding = Persistence.persistence.binding(uiSourceCode); 48 var binding = Persistence.persistence.binding(uiSourceCode);
51 if (!binding) 49 if (!binding)
52 return null; 50 return null;
53 var icon = UI.Icon.create('smallicon-green-checkmark'); 51 var icon = UI.Icon.create('smallicon-green-checkmark');
54 icon.title = Persistence.PersistenceUtils.tooltipForUISourceCode(uiSourceCod e); 52 icon.title = Persistence.PersistenceUtils.tooltipForUISourceCode(uiSourceCod e);
55 return icon; 53 return icon;
56 } 54 }
57 }; 55 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698