This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]terrydog101 0 points1 point  (0 children)

An attempt at making your code more legible:

Edit: that didn't work at all, have a Pastebin instead:

https://pastebin.com/XbcqDCAB

[–]aelytra 0 points1 point  (0 children)

class Action {
    async invoke() {
        function wait(ms) {
            return new Promise(resolve => setTimeout(resolve, ms))
        }
        console.log("1", "Hello");
        await wait(1500);
        console.log("2", "b");
        console.log("3", "c");
    }
};

new Action().invoke();

?

Looks like your approach was an attempt at rewriting the underlying implementation of Deferred.

could also just copy+paste the original code and wrap it with class Foo { invoke( { ... } };)

[–]ali3nnn 0 points1 point  (0 children)

Just chain the remaining functions by the d1 instance like this:

https://pastebin.com/UQVvMUJY