Open junhui75165 opened 7 years ago
Can you write out a piece of example code that shows what you'd like to be able to do please?
AFAIK, most storage mechanisms are synchronous so I'm not sure that exposing an async method would be safe. However, the following is probably what was intended:
import * as store from "store"
store.set("some_key", "some_keyed_value");
store.get("some_key")
.then(value => {
console.log(value);
/* Should print 'some_keyed_value' to console */
});
This doesn't really make sense. Why would a read from localstorage by asynchronous?
@genu Agreed, but there are async storage APIs out there which store.js could handle if it had an async capability. Although deprecated, WebSQL is an example of an async storage API, there may be others these days, but it's been a while since I looked.
something like promise .then