I'm submitting a ... (check one with "x")
[x] bug report
[ ] feature request
Current behavior:
The inAppPurchase2.ready() seems to be a promise but when I use 'then' with a callback inside it not firing the callback.
Expected behavior:
inAppPurchase2.ready().then(() => { code should fire here but it won't })
Steps to reproduce:
inAppPurchase2.ready().then(() => { console.log('why are you not here...'); })
Other information:
I think the logic of the promise is not implemented because when I modified your script to work like before: window.store.ready(callback_here), so use like this: inAppPurchase2.ready(() => { console.log('woooow it work!!') }) => It works!!!
It seems that the plugin API has changed. The following change in the node_modules/@ionic-native/in-app-purchase-2/index.d.ts file fixes the API.
From
ready(): Promise<void>;
To
ready(Function): void;
Then you need to change your code what the poster mentioned
inAppPurchase2.ready(() => { console.log('woooow it work!!') })
It would be nice if the API could be fixed so we don't have to make this change ourselves.
pull request: https://github.com/ionic-team/ionic-native/pull/2043
duplicate
Thanks @CoDanny was going crazy since yesterday in the example code it was store.ready().then((status) => which never compiled through till I change the ready function with callback which again failed during runtime taken away hours of effort till I landed here, Thank you.
Most helpful comment
Thanks @CoDanny was going crazy since yesterday in the example code it was store.ready().then((status) => which never compiled through till I change the ready function with callback which again failed during runtime taken away hours of effort till I landed here, Thank you.