git ssb

1+

Daan Patchwork / patchwork



Tree: 8ccc9fb88d1bc2aa39a121fca766f8ba30115656

Files: 8ccc9fb88d1bc2aa39a121fca766f8ba30115656 / assets / base.html

1120 bytesRaw
1<!DOCTYPE html>
2<html>
3 <head></head>
4 <body>
5 <script>
6 // redirect console to main process
7 var electron = require('electron')
8 var localLog = console.log
9 var localError = console.error
10 var remoteLog = function (o) {
11 const payload = JSON.parse(JSON.stringify(o, null, 2))
12 electron.ipcRenderer.invoke('consoleLog', `${payload}`)
13 }
14 var remoteError = function (o) {
15 const payload = JSON.parse(JSON.stringify(o, null, 2))
16 electron.ipcRenderer.invoke('consoleError', `${payload}`)
17 }
18
19 console.log = function (...args) {
20 localLog.apply(console, args)
21 remoteLog(...args)
22 }
23
24 console.error = function (...args) {
25 localError.apply(console, args)
26 remoteError(...args)
27 }
28
29 process.exit = function(status) {electron.ipcRenderer.sendSync('exit')}
30 // redirect errors to stderr
31 window.addEventListener('error', function (e) {
32 e.preventDefault()
33 console.log(e)
34 console.error(e.error?.stack || 'Uncaught ' + e.error)
35 })
36 </script>
37 </body>
38</html>
39

Built with git-ssb-web