2020-01-20 14:36:18 +00:00
|
|
|
import { PluginObject } from 'vue'
|
2020-01-23 15:23:26 +00:00
|
|
|
import { NekoClient } from '~/neko'
|
2020-01-20 14:36:18 +00:00
|
|
|
|
2020-01-22 17:16:40 +00:00
|
|
|
declare global {
|
|
|
|
const $client: NekoClient
|
|
|
|
|
|
|
|
interface Window {
|
|
|
|
$client: NekoClient
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
declare module 'vue/types/vue' {
|
|
|
|
interface Vue {
|
|
|
|
$client: NekoClient
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-20 14:36:18 +00:00
|
|
|
const plugin: PluginObject<undefined> = {
|
|
|
|
install(Vue) {
|
2020-01-22 17:16:40 +00:00
|
|
|
window.$client = new NekoClient()
|
2020-01-20 14:36:18 +00:00
|
|
|
.on('error', error => console.error('[%cNEKO%c] %cERR', 'color: #498ad8;', '', 'color: #d84949;', error))
|
|
|
|
.on('warn', (...log) => console.warn('[%cNEKO%c] %cWRN', 'color: #498ad8;', '', 'color: #eae364;', ...log))
|
|
|
|
.on('info', (...log) => console.info('[%cNEKO%c] %cINF', 'color: #498ad8;', '', 'color: #4ac94c;', ...log))
|
|
|
|
.on('debug', (...log) => console.log('[%cNEKO%c] %cDBG', 'color: #498ad8;', '', 'color: #eae364;', ...log))
|
|
|
|
|
2020-01-22 17:16:40 +00:00
|
|
|
Vue.prototype.$client = window.$client
|
2020-01-20 14:36:18 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
export default plugin
|