From 83b80b5b3d70bc06344fb64d31fed1434ac98114 Mon Sep 17 00:00:00 2001 From: Blake Byrnes Date: Tue, 14 Dec 2021 16:04:21 -0500 Subject: [PATCH] fix(client): reload should return a resource Closes #393 --- client/lib/Agent.ts | 2 +- client/lib/CoreTab.ts | 2 +- client/lib/FrozenTab.ts | 5 +++-- client/lib/Tab.ts | 5 +++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/client/lib/Agent.ts b/client/lib/Agent.ts index fbb9dc14d..37a9b59ca 100644 --- a/client/lib/Agent.ts +++ b/client/lib/Agent.ts @@ -373,7 +373,7 @@ export default class Agent extends AwaitedEventTarget<{ close: void }> { return this.activeTab.goForward(timeoutMs); } - public reload(timeoutMs?: number): Promise { + public reload(timeoutMs?: number): Promise { return this.activeTab.reload(timeoutMs); } diff --git a/client/lib/CoreTab.ts b/client/lib/CoreTab.ts index ffb2004c9..fed3f0854 100644 --- a/client/lib/CoreTab.ts +++ b/client/lib/CoreTab.ts @@ -103,7 +103,7 @@ export default class CoreTab implements IJsPathEventTarget { return await this.commandQueue.run('Tab.goForward', timeoutMs); } - public async reload(timeoutMs?: number): Promise { + public async reload(timeoutMs?: number): Promise { return await this.commandQueue.run('Tab.reload', timeoutMs); } diff --git a/client/lib/FrozenTab.ts b/client/lib/FrozenTab.ts index 370c696cf..af78b9561 100644 --- a/client/lib/FrozenTab.ts +++ b/client/lib/FrozenTab.ts @@ -121,9 +121,10 @@ export default class FrozenTab { return coreTab.goForward(timeoutMs); } - public async reload(timeoutMs?: number): Promise { + public async reload(timeoutMs?: number): Promise { const coreTab = await getCoreTab(this); - return coreTab.reload(timeoutMs); + const resource = await coreTab.reload(timeoutMs); + return createResource(Promise.resolve(coreTab), resource); } public async getJsValue(path: string): Promise { diff --git a/client/lib/Tab.ts b/client/lib/Tab.ts index 6611368a8..cb9aa25f2 100644 --- a/client/lib/Tab.ts +++ b/client/lib/Tab.ts @@ -171,9 +171,10 @@ export default class Tab extends AwaitedEventTarget { return coreTab.goForward(timeoutMs); } - public async reload(timeoutMs?: number): Promise { + public async reload(timeoutMs?: number): Promise { const coreTab = await getCoreTab(this); - return coreTab.reload(timeoutMs); + const resource = await coreTab.reload(timeoutMs); + return createResource(Promise.resolve(coreTab), resource); } public async getJsValue(path: string): Promise {