Skip to content
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

Implement IPC messaging API #19

Open
chocolatkey opened this issue Oct 22, 2024 · 0 comments
Open

Implement IPC messaging API #19

chocolatkey opened this issue Oct 22, 2024 · 0 comments
Labels

Comments

@chocolatkey
Copy link
Member

When using the reader as an embedded element within another app, such as an accessibility authoring tool, it is useful to be able to externally control the reader, which may be embedded using an <iframe> or opened as a popup. This is possible using the postMessage web API. An example of this communication could look like:

const reader = document.getElementById("reader"); // Reader <iframe>
reader.contentWindow.postMessage({
    _playgroundIPC: 1,
    id: crypto.randomUUID(),
    key: "go",
    data: {
        locator: {
            href: "OPS/chapter_001.xhtml",
            type: "application/xhtml+xml",
            locations: {
                cssSelector: "body>section>p:last-child"
            }
        }
    }
}, "*");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Draft
Development

No branches or pull requests

2 participants