Add 1 extra delayed big frames render at page load

Without getting into the whole CSS transitions problem, this is a quick
solution to ensuring that text both loads as quickly as possible and
also loads aftera delay fo 500ms when hopefully all page load
transitions have completed.

Touches #39
This commit is contained in:
Thomas Buckley-Houston 2018-06-23 17:14:18 +08:00
parent f01b72daeb
commit 802a61204d
2 changed files with 8 additions and 2 deletions

View file

@ -98,7 +98,13 @@ export default class extends utils.mixins(CommonMixin, CommandsMixin) {
_setupInteractiveMode() { _setupInteractiveMode() {
this._setupDebouncedFunctions(); this._setupDebouncedFunctions();
this._startMutationObserver(); this._startMutationObserver();
this.sendAllBigFrames(); this.sendAllBigFrames()
// Send again for pages that have page load transition effects :/
// TODO:
// Disabling CSS transitions is not easy, many pages won't even render
// if they're disabled. Eg; Google's login process.
// What if we could get a post-transition hook?
setTimeout(()=> {this.sendAllBigFrames()}, 500);
} }
_setupDebouncedFunctions() { _setupDebouncedFunctions() {

View file

@ -42,8 +42,8 @@ export default class extends utils.mixins(CommonMixin, SerialiseMixin) {
buildFormattedText() { buildFormattedText() {
this._updateState(); this._updateState();
this.graphics_builder.getScreenshotWithText();
this.graphics_builder.getScreenshotWithoutText(); this.graphics_builder.getScreenshotWithoutText();
this.graphics_builder.getScreenshotWithText();
this._getTextNodes(); this._getTextNodes();
this._positionTextNodes(); this._positionTextNodes();
} }