Closed kolyneh closed 5 years ago
The problem is, that getAllDataForKey
calls getIdsForKey
, which in turn doesn't wait for the internal _mapPromise
to resolve and for that reason this._m
is undefined. In order to fix it, the getIdsForKey
needs to be changed asynchronous and it must wait for the internal _mapPromise
to be resolved, like most other async methods do. The documentation actually already says that getIdsForKey
returns a Promise, but it doesn't.
As a workaround, you can call load
before getAllDataForKey
, like this:
try { await storage.load({key}); } catch(e) {};
let data = await storage.getAllDataForKey(key);
That's true. Thanks for reminding! @juhasuni
使用
v1.0.0
版本出现 getAllDataForKey crash,错误信息如下:undefined is not an object (evaluating '_this._m.__keys__')
退回v0.2.4
版本就没问题。