When working with the phonegap-plugin-push for cordova, you will come across various functions that use the following syntax:
function name(successCallback(),errorCallback(),options)
I am interested in creating a wrapper function that returns an Observable, but I'm facing some challenges when it comes to implementing it using typescript for angular2.
So, ideally, the code should resemble something like this:
name.subscribe((data)=>{...},(err)=>{})
Up until now, my experience has mostly involved subscribing to existing observables like http.
Therefore, the implementation should be similar to:
public unregister(options):Observable<any>{
if(window.PushNotification){
window.PushNotification.unregister(...)
}
}
Any help in advance would be greatly appreciated!