mirror of
https://github.com/frappe/books.git
synced 2024-12-23 11:29:03 +00:00
incr: add open count and set config on win if dev
This commit is contained in:
parent
67cb1620b2
commit
bada1f3969
@ -10,6 +10,7 @@ export enum ConfigKeys {
|
||||
Language = 'language',
|
||||
DeviceId = 'deviceId',
|
||||
Telemetry = 'telemetry',
|
||||
OpenCount = 'openCount',
|
||||
}
|
||||
|
||||
export enum TelemetrySetting {
|
||||
|
21
src/main.js
21
src/main.js
@ -4,7 +4,7 @@ import { createApp } from 'vue';
|
||||
import models from '../models';
|
||||
import App from './App';
|
||||
import FeatherIcon from './components/FeatherIcon';
|
||||
import config from './config';
|
||||
import config, { ConfigKeys } from './config';
|
||||
import { getErrorHandled, handleError } from './errorHandling';
|
||||
import { IPC_CHANNELS, IPC_MESSAGES } from './messages';
|
||||
import router from './router';
|
||||
@ -17,6 +17,10 @@ import { setLanguageMap, showToast, stringifyCircular } from './utils';
|
||||
await setLanguageMap(language);
|
||||
}
|
||||
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
window.config = config;
|
||||
}
|
||||
|
||||
frappe.isServer = true;
|
||||
frappe.isElectron = true;
|
||||
frappe.initializeAndRegister(models, language);
|
||||
@ -85,9 +89,21 @@ import { setLanguageMap, showToast, stringifyCircular } from './utils';
|
||||
console.error(err, vm, info);
|
||||
};
|
||||
|
||||
incrementOpenCount();
|
||||
app.mount('body');
|
||||
})();
|
||||
|
||||
function incrementOpenCount() {
|
||||
let openCount = config.get(ConfigKeys.OpenCount);
|
||||
if (typeof openCount !== 'number') {
|
||||
openCount = 1;
|
||||
} else {
|
||||
openCount += 1;
|
||||
}
|
||||
|
||||
config.set(ConfigKeys.OpenCount, openCount);
|
||||
}
|
||||
|
||||
function registerIpcRendererListeners() {
|
||||
ipcRenderer.on(IPC_CHANNELS.STORE_ON_WINDOW, (event, message) => {
|
||||
Object.assign(window.frappe.store, message);
|
||||
@ -143,7 +159,6 @@ function registerIpcRendererListeners() {
|
||||
}
|
||||
|
||||
const telemetryData = telemetry.stop();
|
||||
console.log(telemetryData);
|
||||
// navigator.sendBeacon('', telemetryData)
|
||||
navigator.sendBeacon('http://0.0.0.0:6969', telemetryData);
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user