Using ES6 Classes

Visit http://weblogs.asp.net/dwahlin/getting-started-with-es6-using-classes for more details.

Babel + JSX

let loop = function(iter) {
    new Promise(function(){
        n = 0;
        x = 0;
        while (n < iter * 10000000) {
            n++;
            x += n;
        }
        //resolve();
    })
    return n + 1;
}

async function getSomeText(text, time) {
    n = await loop(time);
    return `value - ${text} was showed with delay ${time} and while is ${n}`;
}

showText("something that works in async way", 4);

async function showText(sometext, time) {
    sometext = await getSomeText(sometext, time);
    console.log(sometext);
}

showText("something that works in async way", 2);

console.log('something that work in main thread');