const done = (result) => {
console.log("kkkk");
return result;
}
const AFun = (done, p1, p2) => {
setTimeout(() => {
done(p1+p2);
}, 1000);
}
const memoizedAsyncFn = memorize(AFun);
memoizedAsyncFn((res)=>{console.log("===>>", res)}, 1, 2);
The following from cache
memoizedAsyncFn((res)=>{console.log("===>>", res)}, 1, 2); // from cache
Previously dealt with AFun returning a Promise, struggled with asynchronous that does not return a Promise.