commit 00918d46510559cdfe8dd96358609143f6f9dd72
parent bf97147bf72f08c0e0a95a47b43c04912569073a
Author: Lorenz A <me@lorenzackermann.xyz>
Date: Mon, 15 Dec 2025 09:53:34 +0000
Bug 2004272 - [devtools] Turn devtools/client/memory/components/tree-map/canvas-utils.js into an ES class. r=devtools-reviewers,nchevobbe
Differential Revision: https://phabricator.services.mozilla.com/D276312
Diffstat:
1 file changed, 17 insertions(+), 16 deletions(-)
diff --git a/devtools/client/memory/components/tree-map/canvas-utils.js b/devtools/client/memory/components/tree-map/canvas-utils.js
@@ -25,24 +25,25 @@ const FULLSCREEN_STYLE = {
/**
* Create the canvases, resize handlers, and return references to them all
- *
- * @param {HTMLDivElement} parentEl
- * @param {number} debounceRate
- * @return {object}
*/
-function Canvases(parentEl, debounceRate) {
- EventEmitter.decorate(this);
- this.container = createContainingDiv(parentEl);
+class Canvases extends EventEmitter {
+ /**
+ *
+ * @param {HTMLDivElement} parentEl
+ * @param {number} debounceRate
+ */
+ constructor(parentEl, debounceRate) {
+ super();
- // This canvas contains all of the treemap
- this.main = createCanvas(this.container, "main");
- // This canvas contains only the zoomed in portion, overlaying the main canvas
- this.zoom = createCanvas(this.container, "zoom");
+ this.container = createContainingDiv(parentEl);
- this.removeHandlers = handleResizes(this, debounceRate);
-}
+ // This canvas contains all of the treemap
+ this.main = createCanvas(this.container, "main");
+ // This canvas contains only the zoomed in portion, overlaying the main canvas
+ this.zoom = createCanvas(this.container, "zoom");
-Canvases.prototype = {
+ this.removeHandlers = handleResizes(this, debounceRate);
+ }
/**
* Remove the handlers and elements
*
@@ -52,8 +53,8 @@ Canvases.prototype = {
this.removeHandlers();
this.container.removeChild(this.main.canvas);
this.container.removeChild(this.zoom.canvas);
- },
-};
+ }
+}
module.exports = Canvases;