mirror of
https://github.com/frappe/books.git
synced 2024-11-10 07:40:55 +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',
|
Language = 'language',
|
||||||
DeviceId = 'deviceId',
|
DeviceId = 'deviceId',
|
||||||
Telemetry = 'telemetry',
|
Telemetry = 'telemetry',
|
||||||
|
OpenCount = 'openCount',
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum TelemetrySetting {
|
export enum TelemetrySetting {
|
||||||
|
21
src/main.js
21
src/main.js
@ -4,7 +4,7 @@ import { createApp } from 'vue';
|
|||||||
import models from '../models';
|
import models from '../models';
|
||||||
import App from './App';
|
import App from './App';
|
||||||
import FeatherIcon from './components/FeatherIcon';
|
import FeatherIcon from './components/FeatherIcon';
|
||||||
import config from './config';
|
import config, { ConfigKeys } from './config';
|
||||||
import { getErrorHandled, handleError } from './errorHandling';
|
import { getErrorHandled, handleError } from './errorHandling';
|
||||||
import { IPC_CHANNELS, IPC_MESSAGES } from './messages';
|
import { IPC_CHANNELS, IPC_MESSAGES } from './messages';
|
||||||
import router from './router';
|
import router from './router';
|
||||||
@ -17,6 +17,10 @@ import { setLanguageMap, showToast, stringifyCircular } from './utils';
|
|||||||
await setLanguageMap(language);
|
await setLanguageMap(language);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (process.env.NODE_ENV === 'development') {
|
||||||
|
window.config = config;
|
||||||
|
}
|
||||||
|
|
||||||
frappe.isServer = true;
|
frappe.isServer = true;
|
||||||
frappe.isElectron = true;
|
frappe.isElectron = true;
|
||||||
frappe.initializeAndRegister(models, language);
|
frappe.initializeAndRegister(models, language);
|
||||||
@ -85,9 +89,21 @@ import { setLanguageMap, showToast, stringifyCircular } from './utils';
|
|||||||
console.error(err, vm, info);
|
console.error(err, vm, info);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
incrementOpenCount();
|
||||||
app.mount('body');
|
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() {
|
function registerIpcRendererListeners() {
|
||||||
ipcRenderer.on(IPC_CHANNELS.STORE_ON_WINDOW, (event, message) => {
|
ipcRenderer.on(IPC_CHANNELS.STORE_ON_WINDOW, (event, message) => {
|
||||||
Object.assign(window.frappe.store, message);
|
Object.assign(window.frappe.store, message);
|
||||||
@ -143,7 +159,6 @@ function registerIpcRendererListeners() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const telemetryData = telemetry.stop();
|
const telemetryData = telemetry.stop();
|
||||||
console.log(telemetryData);
|
navigator.sendBeacon('http://0.0.0.0:6969', telemetryData);
|
||||||
// navigator.sendBeacon('', telemetryData)
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user