const sleep = () => new Promise( (resolve, reject) => setTimeout( () => resolve(), 100 ));
const init = async () => {
performance.mark('One');
await sleep();
performance.mark('Two');
await sleep();
performance.mark('Three');
await sleep();
performance.mark('Four');
}
init().then( () => {
performance.measure('🐪 Outer 🐪', 'One', 'Four');
performance.measure('🐪 Inner 🐪', 'Two', 'Three');
});
This will create marks inside timings