My First Playground

node v18.11.0
version: 2.0.0
endpointsharetweet
This is a playground to test JavaScript. It runs a completely standard copy of Node.js on a virtual server created just for you. Every one of npm’s 300,000+ packages are pre-installed, so try it out:
console.log('dsf') const time = performance.now(); const finalizationRegistry = new FinalizationRegistry((value) => { console.log( `Promise ${value}. Time taken: ${(performance.now() - time).toFixed()}.` ); }); let promiseWithoutResolve = new Promise((resolve) => { setTimeout(() => { console.log("Timeout for the promise that keeps no refs"); }, 100000); }); finalizationRegistry.register(promiseWithoutResolve, " which keeps no references"); promiseWithoutResolve = null; let promiseWithResolve = new Promise((resolve) => { setTimeout(() => { resolve(); }, 100000); }); finalizationRegistry.register(promiseWithResolve , " which keeps resolve function"); promiseWithResolve = null; let promiseWithThen = new Promise(() => {}); let then = promiseWithThen.then(() => { console.log("then reached"); }); finalizationRegistry.register(promiseWithThen, " with `then` chain"); finalizationRegistry.register(then, " then callback"); promiseWithThen = then = null;
Loading…

no comments

    sign in to comment