I have added one button in UI. onclick
of this button I am calling a function which is returning promise. This piece of code supposed to not block the UI but this is blocking the UI.
<button onclick="block()">Click Me</button>
const blockUI = () => {
return Promise.resolve().then(_ =>{
console.log('loop start');
let i=0;
while(i<10000000000) {
i++;
}
return 'loop end'
});
}
const block = ()=> {blockUI().then(d => {
console.log(d);
})}
How can I make this async?