`requestAnimationFrame` is not defined
I am attempting to create a table of contents for a pdf that is being generated in puppeteer.
const body = 'html string'
// add a polyfill script for requestAnimationFrame
await page.addScriptTag({
url: 'https://gist.github.com/paulirish/1579671.js',
});
// add the polyfill for pagedjs to the puppeteer page
await page.addScriptTag({
url: 'https://unpkg.com/pagedjs/dist/paged.polyfill.js',
});
await page.emulateMediaType('print');
// set the html as the content of the page.
await page.setContent(body);
const pages = new Previewer(body);
// ->
//ReferenceError: requestAnimationFrame is not defined
at new Queue (/Users/saundes/r/reports-api/node_modules/pagedjs/lib/utils/queue.js:28:17)
at new Chunker (/Users/saundes/r/reports-api/node_modules/pagedjs/lib/chunker/chunker.js:61:14)
at new Previewer (/Users/saundes/r/reports-api/node_modules/pagedjs/lib/polyfill/previewer.js:42:20)
at generateReport (/Users/saundes/r/reports-api/app/reports/createPdf.js:98:40)
Could you provide some advice on how to resolve this issue