mswjs/storage

Support getting the current value

kettanaito opened this issue · 2 comments

Need to implement an API to return the current value of the storage.

Suggestion

const store = new LiveStorage(...)

store.getValue() // or
store.current() // 

store.value is currently public - is that intended, or to be replaced by a private member and a getter method?

@Aprillion I think it's better to have a designated getter, even if it will mirror the internal value property. That'd give us more control over the value returned and save the users from potential internal breaking changes that we would be able to handle in the designated getter.

At the same time, the current value property must be marked as private.