blob: 5ec7aba275efbd76907c6d2f80958c5c562e2803 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
/* 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/. */
import { EventEmitter } from "resource://gre/modules/EventEmitter.sys.mjs";
// Global event emitter to avoid listening to individual JSWindowActor instances.
// For a single load, several pairs of JSWindowActors might be created in quick
// succession, so listening to events on individual actor instances is usually
// not enough to monitor a load.
export const EventDispatcher = {};
EventEmitter.decorate(EventDispatcher);
// Simple JSWindow actor pair to listen to page show events.
export class DampLoadParent extends JSWindowActorParent {
async receiveMessage(msg) {
const { name, data } = msg;
if (name === "DampLoadChild:PageShow") {
EventDispatcher.emit("DampLoadParent:PageShow", data);
}
}
}
|