-
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(rollbar): Add Rollbar plugin #832
Conversation
* @return {Promise<any>} Returns a promise that resolves when the plugin successfully initializes | ||
*/ | ||
@Cordova() | ||
static init(successCallback?: Function, errorCallback?: Function) { |
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.
Can you add a return type : Promise<any>
to this function. Also keep { return; }
all in the same line.
Thanks.
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.
@ihadeed sure. I documented this function as returning Promise<any>
because, as far as I know, ionic-native
wraps every function in a promise. The plugin function itself doesn't return anything. Is this the right approach or should I document it as returning void
?
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.
Here is an example of how it should look like: https://github.com/driftyco/ionic-native/blob/master/src/plugins/camera.ts#L201
The docs are fine, just need to add a TypeScript return type of 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.
Ok, did it.
* @return {Promise<any>} Returns a promise that resolves when the plugin successfully initializes | ||
*/ | ||
@Cordova() | ||
static init(successCallback?: Function, errorCallback?: Function): Promise<any> { return; } |
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.
You also need to remove successCallback?: Function, errorCallback?: Function
. The @Cordova()
decorator will automatically apply resolve
and reject
of the promise to these arguments.
Sorry I didn't mention this earlier.
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.
No problem, removed it.
No description provided.