Skip to content

Instantly share code, notes, and snippets.

@trycf
trycf / acf2018-beta-futures.cfm
Created April 17, 2018 20:28
Adobe ColdFusion 2018 Beta - Futures
<cfscript>
getAccountBalance = function(){
var balance = 120000;
return balance;
}
function payCreditCardBill(accountBalance){
var ccBill = 1890;
return accountBalance-ccBill;
}
<cfscript>
p = runAsync(); // empty future
p.complete(function(){
sleep(1000)
return "done!"
});
a = p.get();
writeOutput(a()); // displays done!
</cfscript>
<cfscript>
writeDump(server);
</cfscript>
<cfscript>
writeDump(server);
</cfscript>
<cfscript>
a = function () {
writeoutput("a was called!<hr />");
return "a";
}
writeoutput("before runAsync<hr />");
future = runAsync(a);