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

Unified Diff: third_party/WebKit/Source/devtools/front_end/sources/TabbedEditorContainer.js

Issue 2533483002: [DevTools] Typed events and event listeners. (Closed)
Patch Set: Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/sources/TabbedEditorContainer.js
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/TabbedEditorContainer.js b/third_party/WebKit/Source/devtools/front_end/sources/TabbedEditorContainer.js
index 7ecc659634d7aec294f548a7578a23932d99f8ed..63c7bf570a0195cc155c696ac5cbf1b501158215 100644
--- a/third_party/WebKit/Source/devtools/front_end/sources/TabbedEditorContainer.js
+++ b/third_party/WebKit/Source/devtools/front_end/sources/TabbedEditorContainer.js
@@ -61,10 +61,7 @@ Sources.TabbedEditorContainer = class extends Common.Object {
this._tabbedPane.addEventListener(UI.TabbedPane.Events.TabClosed, this._tabClosed, this);
this._tabbedPane.addEventListener(UI.TabbedPane.Events.TabSelected, this._tabSelected, this);
- Persistence.persistence.addEventListener(
- Persistence.Persistence.Events.BindingCreated, this._onBindingCreated, this);
- Persistence.persistence.addEventListener(
- Persistence.Persistence.Events.BindingRemoved, this._onBindingRemoved, this);
+ Persistence.persistence.addEventListener(Persistence.Persistence.BindingChangedEvent, this._onBindingChanged, this);
this._tabIds = new Map();
this._files = {};
@@ -74,10 +71,19 @@ Sources.TabbedEditorContainer = class extends Common.Object {
}
/**
- * @param {!Common.Event} event
+ * @param {!Persistence.Persistence.BindingChangedEvent} event
+ */
+ _onBindingChanged(event) {
+ if (event.created)
+ this._onBindingCreated(event.binding);
+ else
+ this._onBindingRemoved(event.binding);
+ }
+
+ /**
+ * @param {!Persistence.PersistenceBinding} binding
*/
- _onBindingCreated(event) {
- var binding = /** @type {!Persistence.PersistenceBinding} */ (event.data);
+ _onBindingCreated(binding) {
this._updateFileTitle(binding.network);
var networkTabId = this._tabIds.get(binding.network);
@@ -105,10 +111,9 @@ Sources.TabbedEditorContainer = class extends Common.Object {
}
/**
- * @param {!Common.Event} event
+ * @param {!Persistence.PersistenceBinding} binding
*/
- _onBindingRemoved(event) {
- var binding = /** @type {!Persistence.PersistenceBinding} */ (event.data);
+ _onBindingRemoved(binding) {
this._updateFileTitle(binding.network);
var networkTabId = this._tabIds.get(binding.network);

Powered by Google App Engine
This is Rietveld 408576698