Skip to content

Commit 70d2267

Browse files
authored
clients(lr): expose listenForStatus (GoogleChrome#14024)
1 parent 28ab5c2 commit 70d2267

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

clients/devtools/devtools-entry.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ function setUpWorkerConnection(port) {
6868
/** @param {(status: [string, string, string]) => void} listenCallback */
6969
function listenForStatus(listenCallback) {
7070
log.events.addListener('status', listenCallback);
71+
log.events.addListener('warning', listenCallback);
7172
}
7273

7374
/**

clients/lightrider/lightrider-entry.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
import {Buffer} from 'buffer';
1111

12+
import log from 'lighthouse-logger';
1213
import lighthouse from '../../lighthouse-core/index.js';
1314
import LHError from '../../lighthouse-core/lib/lh-error.js';
1415
import preprocessor from '../../lighthouse-core/lib/proto-preprocessor.js';
@@ -103,8 +104,16 @@ export async function runLighthouseInLR(connection, url, flags, lrOpts) {
103104
}
104105
}
105106

107+
/** @param {(status: [string, string, string]) => void} listenCallback */
108+
function listenForStatus(listenCallback) {
109+
log.events.addListener('status', listenCallback);
110+
log.events.addListener('warning', listenCallback);
111+
}
112+
106113
// Expose on window for browser-residing consumers of file.
107114
if (typeof window !== 'undefined') {
108115
// @ts-expect-error - not worth typing a property on `window`.
109116
window.runLighthouseInLR = runLighthouseInLR;
117+
// @ts-expect-error
118+
self.listenForStatus = listenForStatus;
110119
}

0 commit comments

Comments
 (0)