           return () => {
                return new Promise(r => {
                    resolve = r;
                    trigger();
                });
            };
        })();
        
        
        var _resolve = Promise.resolve.bind(Promise);
        var _then = Promise.prototype.then;

        async function delay() {
            return Promise.resolve();
            // two consecutive macro tasks
            //await new Promise(r => setImmediate(r));
            // the next macro task will now b