I have a heavy procedure that blocks my main thread too long. I want to use promises in my function to call other functions when they are finished. I have this example below as code, but I need to implement it with puzzles.
I tried some things (see image in attachment) in puzzles but it never works as I fail to return a promise resolved() value. The documentation didnt help me.
Is this possible with Verge3d puzzles or am I doing it wrong?
code template:
function init() {
return new Promise((resolve, reject) => {
setup().then(() => {
render();
resolve();
}).catch(error => {
reject(error);
});
});
}
function setup() {
return new Promise((resolve, reject) => {
resolve();
});
}
function render() {
}
init().then(() => {
console.log("Render finished");
}).catch(error => {
console.error("error:", error);
});
-
This topic was modified 9 months, 1 week ago by scatman2513.
Attachments:
You must be
logged in to view attached files.