API

Methods and events on a Zine instance.

Methods

const book = new Zine(el, options);

book.flipNext();
book.flipPrev();
book.flipTo(4);

book.getPage();       // current page index
book.getPageCount();

book.setZoom(2);
book.resetZoom();
book.getZoom();

book.update(); // re-measure after the container resizes
book.destroy();

Events

book.on('ready', () => { /* first paint ready */ });
book.on('flipStart', ({ from, to }) => {});
book.on('flipEnd', ({ page }) => {});
book.on('pageChanged', ({ page }) => {});
book.on('zoomChanged', ({ scale }) => {});
book.on('sourceError', ({ index, error }) => {});

// Unsubscribe with the returned function:
const off = book.on('pageChanged', handler);
off();

Debug

Stable seek API for tests and visual regression, not for production UX.

// Deterministic seek for tests / visual tooling
book.debug.setFlipProgress(0.5, 'forward');