зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1468754 Part 3: Add a TrackChangesEmitter helper object, and make ChangesActor listen to it. r=pbro
Depends on D9049 Differential Revision: https://phabricator.services.mozilla.com/D9050 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
8957567558
Коммит
726ef5afd3
|
@ -9,6 +9,7 @@ const protocol = require("devtools/shared/protocol");
|
|||
const {getCSSLexer} = require("devtools/shared/css/lexer");
|
||||
const {LongStringActor} = require("devtools/server/actors/string");
|
||||
const InspectorUtils = require("InspectorUtils");
|
||||
const TrackChangeEmitter = require("devtools/server/actors/utils/track-change-emitter");
|
||||
|
||||
// This will also add the "stylesheet" actor type for protocol.js to recognize
|
||||
|
||||
|
@ -1520,7 +1521,7 @@ var StyleRuleActor = protocol.ActorClassWithSpec(styleRuleSpec, {
|
|||
return;
|
||||
}
|
||||
|
||||
this.emit("track-change", data);
|
||||
TrackChangeEmitter.trackChange(data);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -21,5 +21,6 @@ DevToolsModules(
|
|||
'source-actor-store.js',
|
||||
'stack.js',
|
||||
'TabSources.js',
|
||||
'track-change-emitter.js',
|
||||
'walker-search.js',
|
||||
)
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const EventEmitter = require("devtools/shared/event-emitter");
|
||||
|
||||
/**
|
||||
* A helper class that is listened to by the ChangesActor, and can be
|
||||
* used to send changes to the ChangesActor.
|
||||
*/
|
||||
class TrackChangeEmitter {
|
||||
/**
|
||||
* Initialize this object.
|
||||
*/
|
||||
constructor() {
|
||||
EventEmitter.decorate(this);
|
||||
}
|
||||
|
||||
trackChange(change) {
|
||||
this.emit("track-change", change);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = new TrackChangeEmitter();
|
Загрузка…
Ссылка в новой задаче