Share Brilliantly
davinci css
let transforms = {
task:async function(){ },
result:function(){},
$imports:()=>'data',
promises:[],
guid:0,
$update:($val,that)=>{
let data = $val(that.$imports());
if(that.promise !== undefined) that.recent = true;
else {
that.promise = that.task();
that.promise.then(function(result){
that.result(result, that, $val);
that.promise = undefined;
if(that.recent === true){
that.recent = false;
that.$update($val, that)
}
});
}
}
};
let ts = await import("/lib/functional-state/library/v1.0.0/transforms.mjs");
let transform = ts.asyncOne();
transform.$imports = ()=>'data';
transform.task = async function(){
};
transform.result = function(result, that, $val){
}
let transforms = {
$imports:()=>'data',
promises:[],
guid:0,
$update:($val, that)=>{
let data = $val('data');
that.guid += 1;
let guid = that.guid;
let promise = new Promise(function(resolve, reject){
//... do something
let test = { id:0 };
while(that.promises.length >0 || test.id !== guid){
test = that.promises.shift();
}
if(test.id === guid){
//update whatever
}
});
that.promises.push({
id:guid,
promise:promise
});
}
};
rd.render([button,label],{target:'content'});
let ts = await import("/lib/functional-state/library/v1.0.0/transforms.mjs");
let transform = ts.asyncTruncated();
transform.$imports = ()=>'data';
transform.task = async function(){
};
transform.result = function(result, that, $val){
}