insomnia/app/renderer.html
2017-05-09 21:20:40 -07:00

56 lines
1.4 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Insomnia</title>
</head>
<body>
<div id="root"></div>
<script>
// HOT RELOADING IN DEV
(function () {
const script = document.createElement('script');
script.src = (process.env.HOT) ? 'http://localhost:3333/bundle.js' : './bundle.js';
document.write(script.outerHTML);
}());
</script>
<script>
// UPDATE HANDLERS
(function () {
function showUpdateNotification () {
console.log('-- 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>