35 lines
868 B
TypeScript
35 lines
868 B
TypeScript
import {Fetch} from "./lib/iso.tsx";
|
|
|
|
|
|
const delay =async(inHandler:()=>void, inDelay:number):Promise<void>=>
|
|
{
|
|
return new Promise((accept)=>{
|
|
setTimeout(()=>{
|
|
accept(inHandler());
|
|
}, inDelay);
|
|
});
|
|
};
|
|
|
|
const cacheRecord = {Promise:delay(()=>{}, 1000)};
|
|
|
|
cacheRecord.Promise.then(()=>{console.log(`handler one`)});
|
|
cacheRecord.Promise.then(()=>{console.log(`handler two`)});
|
|
|
|
cacheRecord.Promise = delay(()=>{}, 3000);
|
|
|
|
|
|
/*
|
|
let r1, r2, r3;
|
|
|
|
delay(()=>{r1 = Fetch.Request(`https://catfact.ninja/fact`, undefined, 0.2); console.log(r1); }, 10);
|
|
delay(()=>{r2 = Fetch.Request(`https://catfact.ninja/fact`, undefined, 0.2); console.log(r2); }, 20);
|
|
delay(()=>{r3 = Fetch.Request(`https://catfact.ninja/fact`, undefined, 0.2); console.log(r3); }, 2000);
|
|
|
|
|
|
await delay(()=>{}, 3000);
|
|
|
|
console.log(r1);
|
|
console.log(r2);
|
|
console.log(r3);
|
|
|
|
*/ |