Skip to content

Commit

Permalink
Merge pull request #400 from ulixee/reload
Browse files Browse the repository at this point in the history
fix(client): reload should return a resource
  • Loading branch information
calebjclark authored Dec 14, 2021
2 parents 33f8061 + 83b80b5 commit c55f93e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion client/lib/Agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ export default class Agent extends AwaitedEventTarget<{ close: void }> {
return this.activeTab.goForward(timeoutMs);
}

public reload(timeoutMs?: number): Promise<void> {
public reload(timeoutMs?: number): Promise<Resource> {
return this.activeTab.reload(timeoutMs);
}

Expand Down
2 changes: 1 addition & 1 deletion client/lib/CoreTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export default class CoreTab implements IJsPathEventTarget {
return await this.commandQueue.run('Tab.goForward', timeoutMs);
}

public async reload(timeoutMs?: number): Promise<void> {
public async reload(timeoutMs?: number): Promise<IResourceMeta> {
return await this.commandQueue.run('Tab.reload', timeoutMs);
}

Expand Down
5 changes: 3 additions & 2 deletions client/lib/FrozenTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,10 @@ export default class FrozenTab {
return coreTab.goForward(timeoutMs);
}

public async reload(timeoutMs?: number): Promise<void> {
public async reload(timeoutMs?: number): Promise<Resource> {
const coreTab = await getCoreTab(this);
return coreTab.reload(timeoutMs);
const resource = await coreTab.reload(timeoutMs);
return createResource(Promise.resolve(coreTab), resource);
}

public async getJsValue<T>(path: string): Promise<T> {
Expand Down
5 changes: 3 additions & 2 deletions client/lib/Tab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,10 @@ export default class Tab extends AwaitedEventTarget<IEventType> {
return coreTab.goForward(timeoutMs);
}

public async reload(timeoutMs?: number): Promise<void> {
public async reload(timeoutMs?: number): Promise<Resource> {
const coreTab = await getCoreTab(this);
return coreTab.reload(timeoutMs);
const resource = await coreTab.reload(timeoutMs);
return createResource(Promise.resolve(coreTab), resource);
}

public async getJsValue<T>(path: string): Promise<T> {
Expand Down

0 comments on commit c55f93e

Please sign in to comment.