Skip to content
This repository was archived by the owner on May 7, 2025. It is now read-only.
This repository was archived by the owner on May 7, 2025. It is now read-only.

How to detect when page is loaded #53

Open
@rkwright

Description

@rkwright

From Tom Feldman:
Hi all,
I'm wondering if there is an api somewhere in the readium-shared-js or maybe even some standard javascript I can execute to know when javascript is done figuring out its paging routine. I was previously under the impression that a call to ReadiumSDK.reader.openPageNext() would result in a single callback request of pageDidChange when it was finished. If the spine item changes however, this callback is being requested more than once.

Here's a log of the requests:

2015-03-24 10:44:48.837 SDKLauncher-iOS[2135:209217] Request: file:///private/var/mobile/Containers/Bundle/Application/09A8C37D-532B-43BE-A752-EABE857331CB/SDKLauncher-iOS.app/reader.html
2015-03-24 10:44:49.114 SDKLauncher-iOS[2135:209217] Request: epubobjc:readerDidInitialize
2015-03-24 10:44:49.130 SDKLauncher-iOS[2135:209217] Request: about:blank
2015-03-24 10:44:49.210 SDKLauncher-iOS[2135:209217] Request: epubobjc:settingsDidApply
2015-03-24 10:44:49.233 SDKLauncher-iOS[2135:209217] Request: about:blank
2015-03-24 10:44:49.254 SDKLauncher-iOS[2135:209217] Request: http://127.0.0.1:55661/spi-ad.xhtml
2015-03-24 10:44:49.490 SDKLauncher-iOS[2135:209217] Request: epubobjc:pageDidChange?q={"isRightToLeft":false,"isFixedLayout":false,"spineItemCount":22,"openPages":[{"spineItemPageIndex":0,"spineItemPageCount":1,"idref":"spi_ad","spineItemIndex":1}],"canGoLeft_":false,"canGoRight_":true}
2015-03-24 10:44:54.911 SDKLauncher-iOS[2135:209217] Running open next script
2015-03-24 10:44:54.931 SDKLauncher-iOS[2135:209217] Request: about:blank
2015-03-24 10:44:54.937 SDKLauncher-iOS[2135:209217] Ran open next script
2015-03-24 10:44:54.965 SDKLauncher-iOS[2135:209217] Request: epubobjc:pageDidChange?q={"isRightToLeft":false,"isFixedLayout":false,"spineItemCount":22,"openPages":[{"spineItemPageIndex":0,"spineItemPageCount":1,"idref":"spi_ad","spineItemIndex":1}],"canGoLeft_":false,"canGoRight_":true}
2015-03-24 10:44:55.004 SDKLauncher-iOS[2135:209217] Request: http://127.0.0.1:55661/index.xhtml
2015-03-24 10:44:55.230 SDKLauncher-iOS[2135:209217] Request: epubobjc:pageDidChange?q={"isRightToLeft":false,"isFixedLayout":false,"spineItemCount":22,"openPages":[{"spineItemPageIndex":0,"spineItemPageCount":1,"idref":"id-id2442754","spineItemIndex":2}],"canGoLeft_":true,"canGoRight_":true}

You'll notice one call to the open next script and two pageDidChange events.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions