Andrew Meadowsarchive remaining JS scriptsc0b446c10 years agoHistory
18 lines · 441 B · JavaScript
RawDownload
Script.include('promise.js');var Promise = loadPromise();var prom = new Promise(function(resolve, reject) {    print('making a promise')        // do a thing, possibly async, then…    var thing = true;    if (thing) {        resolve("Stuff worked!");    } else {        print('ERROR')        reject(new Error("It broke"));    }}); // Do something when async doneprom.then(function(result) {    print('result ' + result);});