-
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add drawsBackground parameter for WKWebView #1
Conversation
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.
Thanks for the contribution! And sorry it took me a while to get around to reviewing this. I was concerned about using an undocumented API for this, but I think as long as it is opt-in, it should be ok. I've added a setValue:forUndefinedKey:
implementation to try and avoid crashing if the method stops working in the future.
Thanks. And for the library. I have been using it on 3dviewer.xyz There is an issue I have been facing where the process started for quicklook is never quit and you can see it in Activity Monitor taking up memory. It's called Preview extension Web Content. Have you had this kind of issue before? |
Hm, I have not noticed that, but it's possible that macos keeps the extension alive so it can be reused for multiple previews. Is that what you think is happening, or is it creating a new instance for each preview? |
Its creating a new process each time I open quicklook. Also seems like its created after the quicklook is closed but that could be just a delay and because I was doing it pretty fast. Its even creating multiple processes for the same file Screen.Recording.2024-04-15.at.10.05.32.PM.mp4Also looks like these are never killed, I found them by going through activity monitor after it handn't been restarted for days and found 50+ of these. |
I can reproduce the same behavior on my machine but it looks like they do eventually go away, at least sometimes... I wonder if there is some way to tell WKWebView to tear down the content process after the preview is closed? |
If the OS is keeping PreviewViewController around just in case you preview the same file again, then it might need to be updated to support unloading & reloading the web view each time to avoid this. |
Yeah I am looking for some way to stop the process. |
I guess if JavaScript keeps running in the webview we can use that to detect when the user closes the view either by some window load event or resize event. And then use that to stop the web view in swift. |
I would hope that we can use |
Moving discussion to a new issue #7 |
Add a drawsBackground parameter in Info.plist, which when set to false allows for a transparent background in
<html>
and<body>
.