Log app startup time
This commit is contained in:
parent
8a72607fa7
commit
bba50c8427
4 changed files with 12 additions and 1 deletions
8
main.js
8
main.js
|
@ -866,6 +866,14 @@ function showPermissionsPopupWindow(forCalling, forCamera) {
|
||||||
// Some APIs can only be used after this event occurs.
|
// Some APIs can only be used after this event occurs.
|
||||||
let ready = false;
|
let ready = false;
|
||||||
app.on('ready', async () => {
|
app.on('ready', async () => {
|
||||||
|
const startTime = Date.now();
|
||||||
|
|
||||||
|
// We use this event only a single time to log the startup time of the app
|
||||||
|
// from when it's first ready until the loading screen disappears.
|
||||||
|
ipc.once('signal-app-loaded', () => {
|
||||||
|
console.log('App has finished loading in:', Date.now() - startTime);
|
||||||
|
});
|
||||||
|
|
||||||
const userDataPath = await getRealPath(app.getPath('userData'));
|
const userDataPath = await getRealPath(app.getPath('userData'));
|
||||||
const installPath = await getRealPath(app.getAppPath());
|
const installPath = await getRealPath(app.getAppPath());
|
||||||
|
|
||||||
|
|
|
@ -97,6 +97,8 @@ try {
|
||||||
|
|
||||||
window.setBadgeCount = count => ipc.send('set-badge-count', count);
|
window.setBadgeCount = count => ipc.send('set-badge-count', count);
|
||||||
|
|
||||||
|
window.logAppLoadedEvent = () => ipc.send('signal-app-loaded');
|
||||||
|
|
||||||
// We never do these in our code, so we'll prevent it everywhere
|
// We never do these in our code, so we'll prevent it everywhere
|
||||||
window.open = () => null;
|
window.open = () => null;
|
||||||
// eslint-disable-next-line no-eval, no-multi-assign
|
// eslint-disable-next-line no-eval, no-multi-assign
|
||||||
|
|
|
@ -2118,7 +2118,6 @@ type WhatIsThis = import('./window.d').WhatIsThis;
|
||||||
]);
|
]);
|
||||||
window.log.info('onEmpty: All outstanding database requests complete');
|
window.log.info('onEmpty: All outstanding database requests complete');
|
||||||
initialLoadComplete = true;
|
initialLoadComplete = true;
|
||||||
|
|
||||||
window.readyForUpdates();
|
window.readyForUpdates();
|
||||||
|
|
||||||
// Start listeners here, after we get through our queue.
|
// Start listeners here, after we get through our queue.
|
||||||
|
@ -2140,6 +2139,7 @@ type WhatIsThis = import('./window.d').WhatIsThis;
|
||||||
clearInterval(interval!);
|
clearInterval(interval!);
|
||||||
interval = null;
|
interval = null;
|
||||||
view.onEmpty();
|
view.onEmpty();
|
||||||
|
window.logAppLoadedEvent();
|
||||||
}
|
}
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
|
|
1
ts/window.d.ts
vendored
1
ts/window.d.ts
vendored
|
@ -493,6 +493,7 @@ declare global {
|
||||||
hasSignalAccount: (number: string) => boolean;
|
hasSignalAccount: (number: string) => boolean;
|
||||||
getServerTrustRoot: () => WhatIsThis;
|
getServerTrustRoot: () => WhatIsThis;
|
||||||
readyForUpdates: () => void;
|
readyForUpdates: () => void;
|
||||||
|
logAppLoadedEvent: () => void;
|
||||||
|
|
||||||
// Flags
|
// Flags
|
||||||
isGroupCallingEnabled: () => boolean;
|
isGroupCallingEnabled: () => boolean;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue