Skip to content

feat(mobile-messaging): add callback parameter for Mobile Messaging S… #4930

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -330,10 +330,11 @@ export class MobileMessaging extends AwesomeCordovaNativePlugin {
* @param config. Configuration for Mobile Messaging
* @param config
* @param onInitError
* @param {Function} callback. Called after successful start of Mobile Messaging SDK initialization. Register for registrationUpdated event to know when it's ready to be used.
* @param {Function} onInitError. Error callback

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Consider reordering the parameters to follow the convention of placing optional parameters at the end. This would make the API more consistent with common JavaScript practices. Also, the JSDoc comment for the callback parameter is placed before the @param onInitError comment, which is unconventional. It would be better to place it after the @param config comment and before the @param onInitError comment to maintain consistency with the order of parameters in the function signature.

Suggested change
* @param onInitError
* @param {Function} callback. Called after successful start of Mobile Messaging SDK initialization. Register for registrationUpdated event to know when it's ready to be used.
* @param {Function} onInitError. Error callback
* @param config. Configuration for Mobile Messaging
* @param config
* @param {Function} callback. Called after successful start of Mobile Messaging SDK initialization. Register for registrationUpdated event to know when it's ready to be used.
* @param {Function} onInitError. Error callback

*/
@Cordova({ sync: true })
init(config: Configuration, onInitError?: (error: MobileMessagingError) => void) {
init(config: Configuration, callback?: () => void, onInitError?: (error: MobileMessagingError) => void) {
return;
}

Expand Down