Skip to content
This repository has been archived by the owner on Aug 12, 2022. It is now read-only.

Commit

Permalink
Fix timing when emitting the EPUB didLoad event
Browse files Browse the repository at this point in the history
  • Loading branch information
mickael-menu-mantano committed Jun 14, 2019
1 parent 0ed92a4 commit 4d1fb8b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions r2-streamer-swift/Resources/scripts/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@ var readium = (function() {

// Notify native code that the page has loaded.
window.addEventListener("load", function(){ // on page load
// Notify native code that the page is loaded.
webkit.messageHandlers.didLoad.postMessage("");
window.addEventListener("orientationchange", function() {
orientationChanged();
snapCurrentPosition();
});
orientationChanged();

// Notify native code that the page is loaded after the page is rendered.
window.requestAnimationFrame(function() {
webkit.messageHandlers.didLoad.postMessage("");
});
}, false);

var last_known_scrollX_position = 0;
Expand Down

0 comments on commit 4d1fb8b

Please sign in to comment.