Open
Bug 1298286
Opened 9 years ago
Updated 8 months ago
[meta] Switch to ES6 classes in devtools
Categories
(DevTools :: General, task, P3)
DevTools
General
Tracking
(Not tracked)
NEW
People
(Reporter: ntim, Unassigned)
References
Details
(Keywords: meta)
No description provided.
Reporter | ||
Comment 1•9 years ago
|
||
It seems like a nice improvement, and other parts of Firefox (eg. WebExtensions) use those.
Things to figure out:
- how to convert Task.async() methods: `methodName: Task.async(function*() {})`
I suspect we could wait for async functions to land, or we could return an async task within a normal function (although that would look ugly).
- how to convert non function properties such as: `MyClass.prototype = { stuff: ["foo","bar"] }`
We could use a getter: class MyClass { get stuff() { return ["foo", "bar"] } }
Although that's longer unfortunately.
But if they are constants, we can simply change them to top level vars.
Reporter | ||
Comment 2•9 years ago
|
||
Status of async functions: bug 1185106
Reporter | ||
Comment 3•9 years ago
|
||
Probably not the priority right now with more important stuff like devtools.html, but still worth a discussion for code we write in the future.
Also, for react components, do we want to use createClass? or class foo extends ReactComp?
Alex, Ryan, wdyt ?
Reporter | ||
Comment 4•9 years ago
|
||
Also, I see lots of usage of Heritage.extend() so this will be a great opportunity to kill that.
I would say the main blocked at the moment is there is no JIT support for ES6 classes (bug 1167472), so I'd expect them to be slower than the traditional equivalent. I think we'd want to wait for that, at least before using them all over the place.
So, we can think about making some changes once these JS features are really ready to go, but I don't see a need to do something right away.
(In reply to Tim Nguyen :ntim (use needinfo?) from comment #3)
> Also, for react components, do we want to use createClass? or class foo
> extends ReactComp?
Bug 1253693 comment 1 suggests we would likely move away from createClass to ES6 classes for React components once the JIT issue is resolved.
Comment 7•9 years ago
|
||
Nothing much to add.
Heritage is often used for single inheritance which could be done with just regular prototype usage.
I see classes as a nice to have. We should first give it a try on a new codebase rather than refactoring everything blindly.
Flags: needinfo?(poirot.alex)
Severity: normal → enhancement
Priority: -- → P3
Updated•7 years ago
|
Product: Firefox → DevTools
Updated•3 years ago
|
Severity: normal → S3
Updated•3 years ago
|
Summary: Switch to ES6 classes in devtools → [meta] Switch to ES6 classes in devtools
Updated•8 months ago
|
Type: enhancement → task
You need to log in
before you can comment on or make changes to this bug.
Description
•