commit ac37996dbcf154e00fc6a389c5669802a2a2f5ce
parent c1e3f688d5b030a9cebb6d2e9f1931baa31780fc
Author: Lorenz A <me@lorenzackermann.xyz>
Date: Mon, 8 Dec 2025 08:08:07 +0000
Bug 2004206 - [devtools] Turn grip-provider.js into an ES class. r=devtools-reviewers,nchevobbe
Differential Revision: https://phabricator.services.mozilla.com/D275243
Diffstat:
1 file changed, 12 insertions(+), 14 deletions(-)
diff --git a/devtools/client/dom/content/grip-provider.js b/devtools/client/dom/content/grip-provider.js
@@ -10,17 +10,15 @@ const {
Property,
} = require("resource://devtools/client/dom/content/reducers/grips.js");
-// Implementation
-function GripProvider(grips, dispatch) {
- this.grips = grips;
- this.dispatch = dispatch;
-}
-
/**
* This object provides data for the tree displayed in the tooltip
* content.
*/
-GripProvider.prototype = {
+class GripProvider {
+ constructor(grips, dispatch) {
+ this.grips = grips;
+ this.dispatch = dispatch;
+ }
/**
* Fetches properties from the backend. These properties might be
* displayed as child objects in e.g. a tree UI widget.
@@ -43,7 +41,7 @@ GripProvider.prototype = {
}
return props;
- },
+ }
hasChildren(object) {
if (object instanceof Property) {
@@ -71,7 +69,7 @@ GripProvider.prototype = {
}
return null;
- },
+ }
getValue(object) {
if (object instanceof Property) {
@@ -82,21 +80,21 @@ GripProvider.prototype = {
}
return object;
- },
+ }
getLabel(object) {
return object instanceof Property ? object.name : null;
- },
+ }
getKey(object) {
return object instanceof Property ? object.key : null;
- },
+ }
getType(object) {
const grip = object?.getGrip ? object.getGrip() : object;
return grip.class ? grip.class : "";
- },
-};
+ }
+}
// Exports from this module
exports.GripProvider = GripProvider;