Skip to content
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

ready promise not firing @ionic-native/in-app-purchase-2 #1869

Closed
lycwed opened this issue Aug 7, 2017 · 4 comments
Closed

ready promise not firing @ionic-native/in-app-purchase-2 #1869

lycwed opened this issue Aug 7, 2017 · 4 comments

Comments

@lycwed
Copy link

lycwed commented Aug 7, 2017

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

@CoDanny
Copy link

CoDanny commented Sep 27, 2017

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.

@bshafiee
Copy link
Contributor

pull request: #2043

@danielsogl
Copy link
Owner

duplicate

@nagthgr8
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants