From 6d34314457fc92f76e57a5fa1f8e99dfb4d50aaf Mon Sep 17 00:00:00 2001 From: lvs Date: Thu, 11 Jul 2019 23:55:30 +0800 Subject: [PATCH] Remind user the executeJavaScript will not run their code immediately (#19129) Remind user the contents.executeJavaScript will not run their code immediately if the web page still in running. Without the knowledge, user would think their code not function properly and it's hard to debug because different page have different loading time. According to [web-contents.js](https://github.com/electron/electron/blob/731edbe2b6a767ce5dab8b5760bc66c687b749cf/lib/browser/api/web-contents.js#L199) --- docs/api/web-contents.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/api/web-contents.md b/docs/api/web-contents.md index bba6bd6e2b9c..d5ecf0aa1d96 100644 --- a/docs/api/web-contents.md +++ b/docs/api/web-contents.md @@ -1034,6 +1034,8 @@ In the browser window some HTML APIs like `requestFullScreen` can only be invoked by a gesture from the user. Setting `userGesture` to `true` will remove this limitation. +Code execution will be suspended until web page stop loading. + ```js contents.executeJavaScript('fetch("https://jsonplaceholder.typicode.com/users/1").then(resp => resp.json())', true) .then((result) => {