insomnia/app/renderer.html
Gregory Schier 7adf8591c1
Switch to Google Analytics API (#609)
* Almost working

* First working implementation

* Simplified analytics utils

* Fix tests
2017-11-18 22:47:54 +00:00

68 lines
1.8 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Insomnia</title>
</head>
<body>
<div id="root"></div>
<div id="dropdowns-container"></div>
<div id="tooltips-container"></div>
<script>
// HOT RELOADING IN DEV
(function () {
const script = document.createElement('script');
script.async = true; // Make Chrome not warn about cross-origin script blocking
script.src = process.env.HOT
? 'http://localhost:3333/bundle.js'
: 'bundle.js';
document.write(script.outerHTML);
if (process.env.HOT) {
const msg = 'Waiting for build server. The initial build can ' +
'take over a minute on slower hardware.';
document.querySelector('#root').innerHTML = `<p>${msg}</p>`;
}
}());
</script>
<script>
// UPDATE HANDLERS
(function () {
function showUpdateNotification () {
console.log('[app] Update Available');
// eslint-disable-next-line no-new
new window.Notification('Insomnia Update Ready', {
body: 'Relaunch the app for it to take effect',
silent: true,
sticky: true
});
}
const {ipcRenderer} = require('electron');
ipcRenderer.on('update-available', () => {
// Give it a few seconds before showing this. Sometimes, when
// you relaunch too soon it doesn't work the first time.
setTimeout(showUpdateNotification, 1000 * 10);
});
})();
</script>
<script>
(function () {
const {productName, version} = require('./package.json');
if (process.env.INSOMNIA_ENV === 'development') {
document.title = `${productName}`;
} else {
document.title = `${productName} v${version}`;
}
})();
</script>
<script>
// SOME HELPERS
document.body.setAttribute('data-platform', process.platform);
</script>
</body>
</html>