-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(native-storage): add initWithSuiteName #3365
Conversation
* @returns {Promise<any>} | ||
*/ | ||
@Cordova() | ||
initWithSuiteName(reference: string): Promise<any> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add an callback interface of set the return type to Promsie<void>
if the callback is empty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand, do you mean that the return type should be changed to Promise<void>
or that it needs some logic to check for empty? I've found that the underlying plugin code doesn't recognise an undefined variable (or an empty string) as a null parameter, and so it never returns an error message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If your promise callback contains Data you should add an interface describing the data like Promise<MyCallbackInterface>
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I was following the style of the other methods, which return Promise<any>
, but I will change this to Promise<void>
, as the plugin implementation never returns the error message.
I have two other questions:
- I've realised that I can add
platforms: ['iOS']
to the decorator, as this is iOS only. Should I do that? - Do I need to raise a separate PR if I want to add the same changes to the v4 branch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you should add the platform. Ionic Native 4 is not supported anymore so you don't have to create another PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thanks. Requested changes have been made.
Required if you want to provide access to storage shared between apps in an app group in iOS.
Relevant section of the documentation for the plugin:
https://github.com/TheCocoaProject/cordova-plugin-nativestorage#usage