latentflip / loupe

Visualizing the javascript runtime at runtime

Home Page:http://latentflip.com/loupe

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Promises are not supported

mohamed-abdul-fattah opened this issue · comments

I tried to run this code, it only runs the first line then nothing...

console.log('1st line');
const promise1 = new Promise((resolve, reject) => {
  resolve('Promise1 resolved');
});
promise1.then((result, err) => {
  console.log(result);
});
console.log('last line');

Note: it works fine on chrome.

I also can't execute this code, even on Chrome.

My intention is to play with setTimeout and Promises. This is a very interesting educational tool!

Works, but not show in task queue

Promise.resolve({ then: function() {
    console.log('promise');
}});

Following code not running:

pr = new Promise(function(resolve, reject) {
    setTimeout(() => reject('bzzz'), 5000);
});

pr.then(
    result => alert(result),
    error => alert(error)
);

Promises are not properly supported no. They should run but will not be visualised correctly.

@latentflip would be required to support them? I've not actually been able to get Promises running at all.

I'm interested in doing a little lighting talk at my work about the event loop, and would love to use this to show off some things, so ideally if possible I'd love to get async/await & Promises working.

async/await is obviously a whole other kettle of fish,m and I don't entirely know if it'd be possible, but it'd be great if I could get promises at least somewhat working.

Are there any pointers you could provide? The code is very old, so it's proving rather hard to even find where things are happening, and hence anything info you could provide would be a boon :D