import { PluginObject } from 'vue' export const tm = { sources: {}, po (en: string, data: object = {}) { this.sources[en] = data }, on (en, cb: (d: object) => any) { const data = this.sources[en] delete this.sources[en] if (!data) return cb(data) } } const Tm: PluginObject = { install(Vue) { Vue.prototype.$tm = tm } } export default Tm