2018-06-11 09:46:25 +00:00
|
|
|
// frappejs imports
|
|
|
|
import frappe from 'frappejs';
|
|
|
|
import common from 'frappejs/common';
|
|
|
|
import coreModels from 'frappejs/models';
|
2019-12-12 17:37:43 +00:00
|
|
|
import FeatherIcon from 'frappejs/ui/components/FeatherIcon';
|
|
|
|
import outsideClickDirective from 'frappejs/ui/plugins/outsideClickDirective';
|
2018-06-11 09:46:25 +00:00
|
|
|
import models from '../models';
|
2019-12-12 17:37:43 +00:00
|
|
|
import { ipcRenderer } from 'electron';
|
|
|
|
|
|
|
|
// vue imports
|
|
|
|
import Vue from 'vue';
|
|
|
|
import PortalVue from 'portal-vue';
|
|
|
|
import App from './App';
|
|
|
|
import router from './router';
|
|
|
|
|
|
|
|
(async () => {
|
|
|
|
frappe.isServer = true;
|
|
|
|
frappe.isElectron = true;
|
|
|
|
frappe.init();
|
|
|
|
frappe.registerLibs(common);
|
|
|
|
frappe.registerModels(coreModels);
|
|
|
|
frappe.registerModels(models);
|
|
|
|
frappe.fetch = window.fetch.bind();
|
|
|
|
|
|
|
|
frappe.events.on('reload-main-window', () => {
|
|
|
|
ipcRenderer.send('reload-main-window');
|
|
|
|
});
|
|
|
|
|
2019-12-27 06:37:39 +00:00
|
|
|
frappe.events.on('check-for-updates', () => {
|
|
|
|
let { autoUpdate } = frappe.AccountingSettings;
|
|
|
|
if (autoUpdate == null || autoUpdate === 1) {
|
|
|
|
ipcRenderer.send('check-for-updates');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-12-12 17:37:43 +00:00
|
|
|
window.frappe = frappe;
|
|
|
|
|
|
|
|
Vue.config.productionTip = false;
|
|
|
|
Vue.component('feather-icon', FeatherIcon);
|
|
|
|
Vue.directive('on-outside-click', outsideClickDirective);
|
|
|
|
Vue.use(PortalVue);
|
|
|
|
Vue.mixin({
|
|
|
|
computed: {
|
|
|
|
frappe() {
|
|
|
|
return frappe;
|
2019-12-16 11:34:22 +00:00
|
|
|
},
|
|
|
|
platform() {
|
|
|
|
return {
|
|
|
|
win32: 'Windows',
|
|
|
|
darwin: 'Mac',
|
|
|
|
linux: 'Linux'
|
|
|
|
}[process.platform];
|
2019-12-12 17:37:43 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
_(...args) {
|
|
|
|
return frappe._(...args);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2018-06-01 12:35:51 +00:00
|
|
|
|
2019-12-12 17:37:43 +00:00
|
|
|
Vue.config.errorHandler = (err, vm, info) => {
|
|
|
|
console.error(err, vm, info);
|
|
|
|
};
|
2018-06-26 11:13:05 +00:00
|
|
|
|
2021-08-18 18:00:35 +00:00
|
|
|
process.on('unhandledRejection', error => {
|
|
|
|
console.error(error);
|
|
|
|
});
|
2021-08-18 16:22:07 +00:00
|
|
|
|
2019-12-12 17:37:43 +00:00
|
|
|
/* eslint-disable no-new */
|
|
|
|
new Vue({
|
|
|
|
el: '#app',
|
|
|
|
router,
|
|
|
|
components: {
|
|
|
|
App
|
|
|
|
},
|
|
|
|
template: '<App/>'
|
|
|
|
});
|
|
|
|
})();
|