f3oall / vue-awesome-notifications

Vue.js version of Awesome Notifications library
MIT License
104 stars 10 forks source link

Set options per call #3

Closed pdcmoreira closed 5 years ago

pdcmoreira commented 6 years ago

Is there a way to pass custom options on each call? Something like this.$awn.tip('Hello world!', options).

mrbookt commented 5 years ago

It's possible to change global options on the fly for ex.:

this.$awn.options.labels.success = 'new success label'; this.$awn.success('some message');

pdcmoreira commented 5 years ago

Sure, but then I have to do something like...

let oldSuccessLabel = this.$awn.options.labels.success // Save original option

this.$awn.options.labels.success = 'new success label' // Set my specific, one-time option

this.$awn.success('some message')

this.$awn.options.labels.success = oldSuccessLabel // Restore the original option

...for each call!

mrbookt commented 5 years ago

yep, unfortunately this is the only way for now as far as I know. The problem is connected to the awesome notifications library (not the vue implementaion) as it sets options upon initialization: https://github.com/f3oall/awesome-notifications#customization

pdcmoreira commented 5 years ago

This will be implemented in v3.0.0 of awesome-notifications, which, I guess, will be reflected in this package.

https://github.com/f3oall/awesome-notifications/issues/9#issuecomment-480947270