ionic-team / capacitor-plugins

Official plugins for Capacitor ⚡️

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

@capacitor/preferences handling things async instead of sync

BridgeAR opened this issue · comments

Feature Request

Plugin

@capacitor/preferences

Description

Right now the preferences module only contains sync code while all operations return promises. This is a minor overhead while executing this and it makes the usage more complicated than it has to be (awaiting otherwise sync code).

Platform(s)

All

Preferred Solution

Since there is no actual async operation, I suggest to rewrite the code by removing all async keywords from the code and publishing it in the next major version accordingly.

Capacitor plugins are all async because the communication from javascript to native and back is async.
That's also true for Preferences plugin, except on web that uses localStorage, which is sync, but it has to be made async to match the native platforms.

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of the plugin, please create a new issue and ensure the template is fully filled out.