Skip to content

Reuse an existing window.PagedConfig instance

Hi,

Hi, we use the before function of window.PagedConfig as a hook to register our custom Handlers.

window.PagedConfig = {
    before: () => {
        
        class MyHandler extends Paged.Handler {
        
            constructor(chunker, polisher, caller) {
                super(chunker, polisher, caller);
            }
        
            afterPageLayout(pageElement, page, breakToken, chunker) {
                // ...
            }
        }

        Paged.registerHandlers(MyHandler)
    }
};

The printer.js creates a new instance of window.PagedConfig before loading PagedJS.

In my humble opinion, you should reuse an existing instance if any and disable the auto preview feature on it.

Regards, Alexandre