Skip to content

Instantly share code, notes, and snippets.

@getify
Last active August 29, 2015 14:10
Show Gist options
  • Save getify/a45bc6d184d8cef14f0c to your computer and use it in GitHub Desktop.
Save getify/a45bc6d184d8cef14f0c to your computer and use it in GitHub Desktop.
(function(){
function alerts(msg) {
return new Promise(function(resolve){
div.innerHTML = msg;
div.style.display = "block";
div.onclick = function(){
div.style.display = "none";
resolve();
};
});
}
var div = document.createElement("div");
document.body.appendChild(div);
})();
function *foo() {
var x = 42;
yield alerts("Hello World: " + x);
console.log("alert finished");
}
run(foo);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment