Skip to content

promises  #265

@parmentelat

Description

@parmentelat

hi

I'm writing a course on JS using ijavascript as the jupyter kernel
and I experience something odd in the section I am currently writing on promises;

what I see is this

if I run in a notebook a cell with this code

promise_ok = new Promise(
    (resolve, reject) => {
        setTimeout(
            // using resolve, we decide what the 
            // eventual result will be
            () => resolve(1000), 10000
        )
    }
)

I observe the kernel hanging for the 10s that the code is running
(if I try to evaluate the next cell for example, I have to wait for 10s for the [*] sign, that says the kernel is busy, to go away)

this is not what I see in a node interpreter running in a terminal, where I immediately get back to the REPL prompt, with a promise object that I can inspect - and see it's pending - and I can compute stuff in the meanwhile before the 10s have passed
(and same in the browser console)

this is a serious impediment since it's the whole point of that course on async programming, to show that the interpreter remains available for other computations

am I missing something here ? is there any known workaround ?

thanks in advance

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions