ionic-team / ionic-team/ionic-storage

The new `storage.create()` method has ambiguous behavior / documentation

Open
#224 12 comments 7 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
456
Forks
97
PR merge metrics
No merged PRs in 30d

Description

In the new `@ionic/storage` API, particularly when using the `storage-angular` module, the behavior of the `storage.create()` method is unclear.

It appears in some parts of the documentation that this method could/should be used to create a new instance of `Storage` that is held and maintained by a central Angular service. Yet in other parts of the documentation, it appears it is enough just to inject the Provider `Storage` into components & services.

The `create()` method needs to be called at least once even is using the direct injection approach, and it's not clear what happens if `create()` is called multiple times. Particularly if the service is injected vs. not injected, etc.

It would be great if the docs could be clarified so that we know when to call `create()` or not. Does it only need to be called once per application, or once every place `Storage` is injected? And what are the consequences of calling it multiple times, even if the return value is ignored?

Thanks!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.