Closed
Bug 1393615
Opened 8 years ago
Closed 6 years ago
[nosdk] use constructor instead of initialize in actors and fronts that inherit Actor/Front classes
Categories
(DevTools :: General, enhancement, P3)
DevTools
General
Tracking
(Not tracked)
RESOLVED
DUPLICATE
of bug 1510949
People
(Reporter: jdescottes, Unassigned)
References
(Blocks 1 open bug)
Details
All fronts and actors inheriting the base Front and Actor classes defined in protocol.js are relying on "initialize" being the constructor of Front and Actor.
We should update each and every front/actor as follows:
> Front.prototype.initialize.call(this, [...]);
should become
> Front.call(this, [...]);
(same for Actor)
Once this is done, the initialize methods exposed on both Actor and Front can be removed.
Then Actor Front and Pool (which is extended by Actor and Front) could be migrated to ES6 classes.
Finally we can migrate fronts and actors to use classes rather than objects:
> const AnimationPlayerFront = FrontClassWithSpec(animationPlayerSpec, {
> initialize: function (conn, form, detail, ctx) {
> Front.call(this, conn, form, detail, ctx);
> // ...
> },
>
> form: function (form, detail) {
> // ...
> },
>
> destroy: function () {
> Front.prototype.destroy.call(this);
> },
> });
to
> const AnimationPlayerFront = FrontClassWithSpec(animationPlayerSpec, class extends Front {
> constructor(conn, form, detail, ctx) {
> super(conn, form, detail, ctx);
> }
>
> form(form, detail) {
> [...]
> }
>
> destroy() {
> super.destroy();
> }
> });
Updated•8 years ago
|
Flags: qe-verify-
Reporter | ||
Comment 1•7 years ago
|
||
I gave this a shot today and switching fronts and actor to ES6 classes will be challenging for another reason. We are using protocol.custom() and protocol.preEvent() to decorate some methods of Front prototypes.
I think we will have to keep using the old extend() approach for the time being.
Updated•7 years ago
|
Severity: normal → enhancement
Updated•7 years ago
|
Whiteboard: [reserve-nosdk]
Updated•7 years ago
|
Product: Firefox → DevTools
Comment 2•6 years ago
|
||
This bug looks like a duplicated or a meta for bug 1510949 and bug 1510951.
Comment 3•6 years ago
|
||
I'll close it then!
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•