simplified typing
This commit is contained in:
@@ -4,7 +4,11 @@ import { DevStore } from 'src/shared/storage/DevStore';
|
||||
|
||||
const hotReloadingHandler: MessageHandler<HotReloadingMessages> = {
|
||||
async reloadExtension({ sendResponse }) {
|
||||
const { isExtensionReloading, isTabReloading } = await DevStore.get(['isExtensionReloading', 'isTabReloading']);
|
||||
const [isExtensionReloading, isTabReloading] = await Promise.all([
|
||||
DevStore.get('isExtensionReloading'),
|
||||
DevStore.get('isTabReloading'),
|
||||
]);
|
||||
|
||||
if (!isExtensionReloading) return sendResponse();
|
||||
|
||||
if (isTabReloading) {
|
||||
|
||||
@@ -24,7 +24,10 @@ const HOT_RELOADING_WHITELIST = [
|
||||
* @returns a promise that resolves when the tab is reloaded
|
||||
*/
|
||||
export async function hotReloadTab(): Promise<void> {
|
||||
const { isTabReloading, reloadTabId } = await DevStore.get(['isTabReloading', 'reloadTabId']);
|
||||
const [isTabReloading, reloadTabId] = await Promise.all([
|
||||
DevStore.get('isTabReloading'),
|
||||
DevStore.get('reloadTabId'),
|
||||
]);
|
||||
|
||||
if (!isTabReloading || !reloadTabId) return;
|
||||
|
||||
|
||||
@@ -5,7 +5,10 @@ import { DevStore } from 'src/shared/storage/DevStore';
|
||||
*/
|
||||
export async function openDebugTab() {
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
const { debugTabId, wasDebugTabVisible } = await DevStore.get(['debugTabId', 'wasDebugTabVisible']);
|
||||
const [debugTabId, wasDebugTabVisible] = await Promise.all([
|
||||
DevStore.get('debugTabId'),
|
||||
DevStore.get('wasDebugTabVisible'),
|
||||
]);
|
||||
|
||||
const isAlreadyOpen = await (await chrome.tabs.query({})).some(tab => tab.id === debugTabId);
|
||||
if (isAlreadyOpen) return;
|
||||
|
||||
Reference in New Issue
Block a user