Oh snap. Start using async+await.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3285 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2016-07-24 17:02:45 +00:00
parent d1eefc249d
commit cca505ff01
2 changed files with 27 additions and 0 deletions

23
tests/10-await Normal file
View File

@ -0,0 +1,23 @@
#!/bin/bash
cat > test.js << EOF
print("hi");
function foobar() {
return new Promise(function (resolve, reject) {
resolve(10);
});
}
async function huh() {
let v = await foobar();
print("v => " + v);
if (v != 10) {
throw new Error("nope");
}
}
huh();
EOF
$TILDEFRIENDS test.js