storj/web/storagenode/src/main.ts
NikolaiYurchenko 384bdf1f58 web/storagenode: code refactoring pt.1
Change-Id: I948261c61e7ed7f9703a85314d7a14ca9a59b16d
2020-02-04 12:06:29 +00:00

39 lines
989 B
TypeScript

// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.\
import Vue, { VNode } from 'vue';
import { DirectiveBinding } from 'vue/types/options';
import App from './app/App.vue';
import { router } from './app/router';
import { store } from './app/store';
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,
render: (h) => h(App),
store,
}).$mount('#app');