Skip to content

Instantly share code, notes, and snippets.

@mzgoddard

mzgoddard/index.html

Created Jul 10, 2019
Embed
What would you like to do?
Time to open an electron window.
<div class="times"></div>
<script>
const now = Date.now();
setTimeout(function () {
const div = document.querySelector('.times');
const search = location.search.substring(1).split('&').map(pair => pair.split('=')).reduce((carry, [key, value]) => {
carry[key] = Number(value);
return carry;
}, {});
const render = Date.now();
div.innerHTML = `Time to start main process JS: ${search.main}
<br/>Time to create window: ${search.window} (${search.window - search.main})
<br/>Time to execute first client script: ${now} (${now - search.window})
<br/>Time to first render: ${render} (${render - now})`;
});
</script>
const mainStart = Date.now();
const electron = require('electron');
electron.app.on('ready', function() {
const window = new electron.BrowserWindow({
width: 640,
height: 480
});
window.loadURL(`file://${__dirname}/index.html?main=${mainStart}&window=${Date.now()}`);
});
{
"name": "electron-start",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"electron": "^5.0.6"
}
}
@mzgoddard

This comment has been minimized.

Copy link
Owner Author

@mzgoddard mzgoddard commented Jul 10, 2019

Screen Shot 0031-07-10 at 1 56 56 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.