-
Notifications
You must be signed in to change notification settings - Fork 188
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
Not async call .convert() for own provided rates #73
Comments
Same requirement. In my case I use mobx managed exchange rates in a react environment. I'll be forced to run side effects (useEffect hooks etc..) to resolve a promise which I know resolves locally. |
Add an alternative, synchronous API to the async convert() that can be used synchronously when the exchange rates are known at the moment of conversion. re dinerojs#73
Add an alternative, synchronous API to the async convert() that can be used synchronously when the exchange rates are known at the moment of conversion. re dinerojs#73
Add an alternative, synchronous API to the async convert() that can be used synchronously when the exchange rates are known at the moment of conversion. re dinerojs#73
Add an alternative, synchronous API to the async convert() that can be used synchronously when the exchange rates are known at the moment of conversion. re dinerojs#73
Add an alternative, synchronous API to the async convert() that can be used synchronously when the exchange rates are known at the moment of conversion. re dinerojs#73
Hey! I've just released Dinero.js v2 alpha with a much better design for conversions. You can provide rates directly, the responsibility of fetching them isn't coupled to the library. You can check it out in the API reference. |
Is your feature request related to a problem? Please describe.
I would find very convenient to stay in synchronous context when using the convert() method with own exchange rates. Without using a immediately resolving Promise.
Describe the solution you'd like
Add optional parameter to convert method for object with rates. It will work with CurrencyConverter as the Promise is only for API calls.
Describe alternatives you've considered
Manual conversion with multiplication and creating new Dinero object.
Additional context
Relates to #17
Thank you for your work and the package. Great job! :)
The text was updated successfully, but these errors were encountered: