Bug 1468754 Part 4: Make ChangesActor fire events. r=pbro

Depends on D9050

Differential Revision: https://phabricator.services.mozilla.com/D9176

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Brad Werth 2018-10-22 18:01:18 +00:00
Родитель 7972326743
Коммит 75b4548fcd
2 изменённых файлов: 20 добавлений и 1 удалений

Просмотреть файл

@ -56,14 +56,18 @@ const ChangesActor = protocol.ActorClassWithSpec(changesSpec, {
pushChange: function(change) {
this.changes.push(change);
this.emit("add-change", change);
},
popChange: function() {
return this.changes.pop();
const change = this.changes.pop();
this.emit("remove-change", change);
return change;
},
clearChanges: function() {
this.changes.length = 0;
this.emit("clear-changes");
},
});

Просмотреть файл

@ -5,6 +5,7 @@
"use strict";
const {
Arg,
generateActorSpec,
RetVal,
} = require("devtools/shared/protocol");
@ -12,6 +13,20 @@ const {
const changesSpec = generateActorSpec({
typeName: "changes",
events: {
"add-change": {
type: "addChange",
change: Arg(0, "json"),
},
"remove-change": {
type: "removeChange",
change: Arg(0, "json"),
},
"clear-changes": {
type: "clearChanges",
},
},
methods: {
"allChanges": {
response: {