Created
May 2, 2017 09:20
-
-
Save ELLIOTTCABLE/cb3cd7b4333524c470d9607494cc0903 to your computer and use it in GitHub Desktop.
ECMAScript 2017 `async` in macOS Sierra JavaScriptCore
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env osascript -l JavaScript | |
// macOS Sierra uses a JavaScriptCore analagous to that in Safari 10.1. This supports all of | |
// ECMAScript 2015 (“ES6”), and even much of ECMAScript 2016! For instance, try `async` functions: | |
async function hello(){ | |
return "Hello, world!" | |
} | |
function run(argv) { | |
var p = hello(); | |
if (!(p instanceof Promise)) throw "No ES2016 support." | |
p.then(result => console.log(result + " (async!)") ) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this. is. amazing.