pinia-cached-store
pinia-cached-store copied to clipboard
Make asynchronous paradigm optional
As mentioned in in #3, awaiting is not really required for all store types. It should be possible to define a store without using promises.
You can await any value, even if it's not a promise.
(async function() {
console.log(await 3);
})();
To get back to the issue: In your case the only requirement should that the value is Callable (see Callable).
Distinguishing between Newable (e.g., new Whatever() – essentially a function returning this) and Callable is possible, but it’s beyond the scope of this library.