Skip to content

Instantly share code, notes, and snippets.

@ELLIOTTCABLE
Created May 2, 2017 09:20
Show Gist options
  • Save ELLIOTTCABLE/cb3cd7b4333524c470d9607494cc0903 to your computer and use it in GitHub Desktop.
Save ELLIOTTCABLE/cb3cd7b4333524c470d9607494cc0903 to your computer and use it in GitHub Desktop.
ECMAScript 2017 `async` in macOS Sierra JavaScriptCore
#!/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!)") )
}
@4r7d3c0
Copy link

4r7d3c0 commented Jul 31, 2020

this. is. amazing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment