2016-11-08 02:39:57 +00:00
|
|
|
// This code will be injected before initializing the root App
|
|
|
|
import Vue from 'vue'
|
|
|
|
import VueNotifications from 'vue-notifications'
|
|
|
|
|
2016-11-24 00:46:20 +00:00
|
|
|
if (process.BROWSER_BUILD) {
|
2016-11-08 02:39:57 +00:00
|
|
|
// Include mini-toaster (or any other UI-notification library
|
|
|
|
const miniToastr = require('mini-toastr')
|
|
|
|
|
|
|
|
// Here we setup messages output to `mini-toastr`
|
|
|
|
const toast = function ({ title, message, type, timeout, cb }) {
|
|
|
|
return miniToastr[type](message, title, timeout, cb)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Binding for methods .success(), .error() and etc. You can specify and map your own methods here.
|
|
|
|
// Required to pipe our outout to UI library (mini-toastr in example here)
|
2016-11-18 03:02:43 +00:00
|
|
|
// All not-specified events (types) would be piped to output in console.
|
2016-11-08 02:39:57 +00:00
|
|
|
const options = {
|
|
|
|
success: toast,
|
|
|
|
error: toast,
|
|
|
|
info: toast,
|
|
|
|
warn: toast
|
|
|
|
}
|
|
|
|
|
|
|
|
// Activate plugin
|
|
|
|
Vue.use(VueNotifications, options)
|
|
|
|
}
|