-
Notifications
You must be signed in to change notification settings - Fork 575
added actions history, back, forward and refresh #59
base: master
Are you sure you want to change the base?
Conversation
added types NavigationHistory and NavigationEntry
if (history && history.currentIndex > 0) { | ||
const {Page} = this.client | ||
await Page.navigateToHistoryEntry({entryId: history.entries[history.currentIndex - 1].id}) | ||
await Page.loadEventFired() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does loadEventFired()
get triggered when navigating back on a hash URL? E.g. From blah.html#section2 back to blah.html#section1?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uhm, no, it does not. You're right.
It also doesn't get triggered when you navigate from blah.html to blah.html#somewhere, which means the current goto-function is buggy, too - if I'm not mistaken.
Guess I just evaluate window.history.back()
, etc. instead. Should have done that in the first place...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's indeed a good point with the hash location. Another option might be Page.frameNavigated
, we should try that out.
Regarding just evaluating window.history.back()
- we try to stay as "native" as possible to prevent side effects with the JS runtime, you never know what weird stuff people do in their global scope...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, substituting Page.loadEventFired
with Page.frameNavigated
seems to work, I tried it locally. But I would still wait with this change before we have tests as it could break stuff that we don't understand yet
Hi @aw31n thank you for raising this PR! We'll take a look shortly. |
@@ -197,6 +205,36 @@ export default class LocalRuntime { | |||
} | |||
} | |||
|
|||
private async history(): Promise<NavigationHistory> { | |||
const {Page} = this.client | |||
await Promise.all([Page.enable()]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a better place to enable Page
? Seems like we'd want to do that at constructor time
Hi @aw31n thank you again for raising this PR! I'm sorry about the delay. We haven't forgotten about you! Due to the proposed change from |
No description provided.