Ionic-native: ready promise not firing @ionic-native/in-app-purchase-2

Created on 7 Aug 2017  路  4Comments  路  Source: ionic-team/ionic-native

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!!!

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.

All 4 comments

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.

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rajanshahsa picture rajanshahsa  路  3Comments

hobbydevs picture hobbydevs  路  3Comments

jgw96 picture jgw96  路  3Comments

goleary picture goleary  路  3Comments

christianwico picture christianwico  路  4Comments