pinia-cached-store icon indicating copy to clipboard operation
pinia-cached-store copied to clipboard

Make asynchronous paradigm optional

Open yrd opened this issue 4 years ago • 1 comments

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.

yrd avatar Dec 13 '21 06:12 yrd

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.

rajmondx avatar Nov 08 '24 07:11 rajmondx