mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2024-11-10 19:56:54 +03:00
Update ready promise (#1320)
This commit is contained in:
parent
c9293470ec
commit
69833d35b2
|
@ -56,7 +56,7 @@ export function inject(
|
|||
startFlag,
|
||||
' require("' + name + '")(' + JSON.stringify(options) + ')',
|
||||
' .then(_remotedev =>',
|
||||
' _remotedev.on("ready", () => {',
|
||||
' _remotedev.ready.then(() => {',
|
||||
' if (!_remotedev.portAlreadyUsed) console.log("-".repeat(80));',
|
||||
' ' + serverFlag,
|
||||
' })',
|
||||
|
|
|
@ -87,10 +87,8 @@ if (argv.injectserver) {
|
|||
);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
server(argv).then(async function (r) {
|
||||
if (argv.open && argv.open !== 'false') {
|
||||
await r.listener('ready').once();
|
||||
await openApp(argv.open as string, options);
|
||||
}
|
||||
});
|
||||
const response = await server(argv);
|
||||
if (argv.open && argv.open !== 'false') {
|
||||
await response.ready;
|
||||
await openApp(argv.open as string, options);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ const LOG_LEVEL_INFO = 3;
|
|||
|
||||
export default async function (argv: { [arg: string]: any }): Promise<{
|
||||
portAlreadyUsed?: boolean;
|
||||
listener: (eventName: 'ready') => { once(): Promise<void> };
|
||||
ready: Promise<void>;
|
||||
}> {
|
||||
const options = Object.assign(getOptions(argv), {
|
||||
allowClientPublish: false,
|
||||
|
@ -29,13 +29,7 @@ export default async function (argv: { [arg: string]: any }): Promise<{
|
|||
}
|
||||
return {
|
||||
portAlreadyUsed: true,
|
||||
listener: function () {
|
||||
return {
|
||||
once() {
|
||||
return Promise.resolve();
|
||||
},
|
||||
};
|
||||
},
|
||||
ready: Promise.resolve(),
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -135,6 +129,9 @@ export default async function (argv: { [arg: string]: any }): Promise<{
|
|||
})();
|
||||
|
||||
httpServer.listen(options.port);
|
||||
// @ts-expect-error Shouldn't there be a 'ready' event?
|
||||
return agServer;
|
||||
return {
|
||||
ready: (async () => {
|
||||
await agServer.listener('ready' as 'error').once();
|
||||
})(),
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user