8000 Chrome tab background performance fixes by frasermince · Pull Request #977 · futurepress/epub.js · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Chrome tab background performance fixes #977

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

Merged
merged 2 commits into from
Nov 7, 2019

Conversation

frasermince
Copy link
Contributor

This change improves performance when epubjs is in a chrome background tab. This is based on the issue #913. We turn off polling when the tab is not being viewed and turn it back on when it is.

@frasermince frasermince force-pushed the fm/chrome-background-fix branch from cbd5426 to 3e67376 Compare September 18, 2019 06:53
@frasermince frasermince force-pushed the fm/chrome-background-fix branch from 3e67376 to f9f3635 Compare September 18, 2019 16:16
@fchasen
Copy link
Contributor
fchasen commented Nov 7, 2019

Thanks. Am I missing something on how this works?
What did you replace the resize listener with?

@fchasen
Copy link
Contributor
fchasen commented Nov 7, 2019

Ah I see, this moves the contents of that function directly into the listeners method.

@fchasen fchasen merged commit 589f5ce into futurepress:master Nov 7, 2019
@mikkelvp
Copy link
Contributor
mikkelvp commented Jun 4, 2020

@fchasen @frasermince

This breaks framing in Safari. Especially iOS webviews.

Example with polling:

[Log] [1591275460443] – "event:" – "resize" (epub.js, line 13561)
[Log] [1591275460443] – {width: 5880} (epub.js, line 23020)
[Log] [1591275460700] – "event:" – "resize" (epub.js, line 13561)
[Log] [1591275460705] – {width: 1960} (epub.js, line 23020)

Without polling the second event is never fired and the correct width is not set. And many blank pages appear.
For some reason Safari takes a while to figure out content width..

I had to revert this commit.

If background polling is a problem, it can probably be solved using visibilitychange https://developer.mozilla.org/en-US/docs/Web/API/Document/visibilitychange_event

mikkelvp pushed a commit to mikkelvp/epub.js that referenced this pull request Jun 4, 2020
@fchasen
Copy link
Contributor
fchasen commented Jun 5, 2020

Thanks for catching that, I'll revert this and try to keep the polling in check with that event.

mikkelvp pushed a commit to mikkelvp/epub.js that referenced this pull request Jun 22, 2020
mikkelvp pushed a commit to wedobooks/epub.js that referenced this pull request Jan 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0