schiehll / react-alert

alerts for React
MIT License
607 stars 99 forks source link

Add onOpen callback #55

Closed mperitz closed 6 years ago

mperitz commented 6 years ago

This pull request adds an onOpen callback feature. This is a function provided in the options to the instance.show method that (similarly to onClose) calls the provided function after the new alert is added to the state.

I added unit tests to show that the onOpen function does get called when instance.show is called, but only if the option is provided.

This feature is useful in a feature I am building for an order management system application, and I feel it could be useful to others as well.

coveralls commented 6 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 07f39ae5b8582a4fd7629581bea36bafbcd303d6 on mperitz:add-onOpen-callback into 146a1cfe1c03efe9624c75a471fae27cda95faae on schiehll:master.

mperitz commented 6 years ago

Hello @schiehll !

I realized that I submitted this PR without consulting you on your development process. Please let me know if I have skipped anything you like to see in your code other than unit tests (which I have covered), or if there is anything more I need to do to get this PR merged.

Thanks!