зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
7972326743
Коммит
75b4548fcd
|
@ -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: {
|
||||
|
|
Загрузка…
Ссылка в новой задаче