storj/web/satellite/src/main.ts

41 lines
1.0 KiB
TypeScript
Raw Normal View History

2019-01-24 20:15:10 +00:00
// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
import Vue, { VNode } from 'vue';
import { DirectiveBinding } from 'vue/types/options';
2019-09-09 11:33:39 +01:00
import App from './App.vue';
import { router } from './router';
import { store } from './store';
Vue.config.devtools = true;
Vue.config.performance = true;
Vue.config.productionTip = false;
let clickOutsideEvent: EventListener;
Vue.directive('click-outside', {
bind: function (el: HTMLElement, binding: DirectiveBinding, vnode: VNode) {
clickOutsideEvent = function(event: Event): void {
if (el === event.target) {
return;
}
if (vnode.context) {
vnode.context[binding.expression](event);
}
};
document.body.addEventListener('click', clickOutsideEvent);
},
unbind: function(): void {
document.body.removeEventListener('click', clickOutsideEvent);
},
});
new Vue({
router,
store,
render: (h) => h(App),
}).$mount('#app');