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

registerHandlers does not work #195

Open
sikorjan opened this issue Mar 21, 2024 · 2 comments
Open

registerHandlers does not work #195

sikorjan opened this issue Mar 21, 2024 · 2 comments

Comments

@sikorjan
Copy link

sikorjan commented Mar 21, 2024

I am trying to register custom handlers but the handlers are never called (afterRendered, afterPageLayout).
I tried it with both v5 and v4. Does it work for you guys? I can see the "Paged.registerHandlers" exists when I execute this code because I am importing the paged polyfill right above this script.

let isPagedFinished = false

const change = () => {
    isPagedFinished = true
}

class MyHandler extends Paged.Handler {
    constructor(chunker, polisher, caller) {
        super(chunker, polisher, caller)
    }

    afterPageLayout(pageFragment, page) {
        debugger
        console.log("page layout")
    }
    afterRendered() {
        debugger
        console.log("afterRendered")
        change()
    }
}
debugger
Paged.registerHandlers(MyHandler)
@julientaq
Copy link
Collaborator

julientaq commented Mar 21, 2024

that should be workin, but it depends when you call em.

there are some examples here: https://pagedjs.org/plugins/ (we’re not sharing them because they are buggy, and may not work with the v0.5.b1.

and some explanation here: 

https://pagedjs.org/documentation/10-handlers-hooks-and-custom-javascript/

@julientaq
Copy link
Collaborator

@sikorjan did you make it work?

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

No branches or pull requests

2 participants