Using ES6 Classes

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

Babel + JSX

let loopAsync = ms => new Promise(resolve => setTimeout(resolve, ms * 1000));

const getSomeTextAsync = async (text, time) =>
  `value - ${text} was showed with delay ${time} and while is ${await loopAsync(time)}`;

const showTextAsync = async (sometext, time) => {
  sometext = await getSomeTextAsync(sometext, time);
  console.log(sometext);
}

showTextAsync('something that works in async way', 4);
showTextAsync('something that works in async way', 1);
console.log('something that work in main thread');