storj/web/storagenode/src/main.ts
NickolaiYurchenko 5c6c797737 web/storagenode: payout info logic implementation
Change-Id: Ief1768f3987fdbf687fda5a90aa3c1c2320b17a1
2020-03-29 20:01:37 +03:00

46 lines
1.2 KiB
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);
},
});
/**
* centsToDollars is a Vue filter that converts amount of cents in dollars string.
*/
Vue.filter('centsToDollars', (cents: number): string => {
return `$${(cents / 100).toFixed(2)}`;
});
new Vue({
router,
render: (h) => h(App),
store,
}).$mount('#app');