/** *Importscodeintoaworklet.E.g. * *importWorklet(CSS.paintWorklet,{url:'script.js'}); *importWorklet(CSS.paintWorklet,'(javascriptstring)'); * *@param{Worklet}worklet *@param{(Object|string)}code
*/ function importWorklet(worklet, code) {
let url; if (typeof code === 'object') {
url = code.url;
} else { const blob = new Blob([code], {type: 'text/javascript'});
url = URL.createObjectURL(blob);
}
return worklet.addModule(url);
}
/** @private */
async function animationFrames(frames) { for (let i = 0; i < frames; i++)
await new Promise(requestAnimationFrame);
}
// This ensures that a commit is accepted and drawn by waiting for a // composited animation to start. /** @private */
async function workletPainted() { const animation =
document.body.animate({ opacity: [0, 1] }, { duration: 1 }); return animation.finished;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.