Migrate resources/ to ESM
Bug: 1006759
Change-Id: Idbbe06ab71b93bd2a2e2652f3ee4f5bd4b68f6ab
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1985673
Commit-Queue: Tim van der Lippe <[email protected]>
Reviewed-by: Paul Lewis <[email protected]>
diff --git a/front_end/resources/ResourcesPanel.js b/front_end/resources/ResourcesPanel.js
index a07c33b..a5bf5da 100644
--- a/front_end/resources/ResourcesPanel.js
+++ b/front_end/resources/ResourcesPanel.js
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-Resources.ResourcesPanel = class extends UI.PanelWithSidebar {
+export default class ResourcesPanel extends UI.PanelWithSidebar {
constructor() {
super('resources');
this.registerRequiredCSS('resources/resourcesPanel.css');
@@ -37,10 +37,10 @@
}
/**
- * @return {!Resources.ResourcesPanel}
+ * @return {!ResourcesPanel}
*/
static _instance() {
- return /** @type {!Resources.ResourcesPanel} */ (self.runtime.sharedInstance(Resources.ResourcesPanel));
+ return /** @type {!ResourcesPanel} */ (self.runtime.sharedInstance(ResourcesPanel));
}
/**
@@ -77,7 +77,7 @@
}
resetView() {
- if (this.visibleView && Resources.ResourcesPanel._shouldCloseOnReset(this.visibleView)) {
+ if (this.visibleView && ResourcesPanel._shouldCloseOnReset(this.visibleView)) {
this.showView(null);
}
}
@@ -183,12 +183,12 @@
}
});
}
-};
+}
/**
* @implements {Common.Revealer}
*/
-Resources.ResourcesPanel.ResourceRevealer = class {
+export class ResourceRevealer {
/**
* @override
* @param {!Object} resource
@@ -198,8 +198,20 @@
if (!(resource instanceof SDK.Resource)) {
return Promise.reject(new Error('Internal error: not a resource'));
}
- const sidebar = Resources.ResourcesPanel._instance()._sidebar;
+ const sidebar = ResourcesPanel._instance()._sidebar;
await UI.viewManager.showView('resources');
await sidebar.showResource(resource);
}
-};
+}
+
+/* Legacy exported object */
+self.Resources = self.Resources || {};
+
+/* Legacy exported object */
+Resources = Resources || {};
+
+/** @constructor */
+Resources.ResourcesPanel = ResourcesPanel;
+
+/** @constructor */
+Resources.ResourcesPanel.ResourceRevealer = ResourceRevealer;