MarshallOfSound / MarshallOfSound/react-electron-web-view

WebView is not ready yet...

Open
#14 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
64
Forks
33
PR merge metrics
No merged PRs in 30d

Description

I am using the following code:

```jsx
componentDidMount() {
try {
this.webView.current.executeJavaScript("$('body, window').scrollTop(100)")
} catch (err) {
console.log("[DidMount]", err.message);
}
setTimeout(() => {
this.webView.current.executeJavaScript("$('body, window').scrollTop(100)")
}, 1000);
}
```
This results in a message `[DidMount] WebView is not ready yet, you can't call this method` followed by a scroll after the timeout period.

I also tried `onDomReady` event handler which fires even earlier with the message `[DomReady] Cannot read property 'executeJavaScript' of null`.

What is the best method of invoking a method when the webview is ready?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the componentDidMount and onDomReady examples in the issue, then trace the WebView lifecycle around executeJavaScript and the reported readiness errors. Reproduce the timing behavior and identify the documented lifecycle point for invoking methods; done means the invocation works without the timeout and avoids the null or not-ready errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
electron, javascript, react
Domain
desktop, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.