launcher: add a console that prints stderr and stdout

This commit is contained in:
bordun 2017-09-16 15:35:43 +02:00
parent 28b1fc2d4f
commit 9e0ad98955
5 changed files with 84 additions and 10 deletions

View file

@ -167,20 +167,32 @@ $(document).ready(()=>{
})
form.appendTo('#launcher')
// server started callback
ipcRenderer.on('started',function(){
var addresses = settings.read('appAddresses').map((a)=>{return `<a href="${a}">${a}</a>`})
start.addClass('started').html('App available at ' + addresses.join(' & '))
start.remove()
save.remove()
terminal.show()
})
// Fake console
var terminal = $(`<div class="terminal"></div>`).appendTo('#launcher').hide()
ipcRenderer.on('stdout', function(e, msg){
terminal.append(`<div class="log">${msg}</div>`)
terminal.scrollTop(terminal.prop('scrollHeight'))
})
ipcRenderer.on('stderr', function(e, msg){
terminal.append(`<div class="error">${msg}</div>`)
terminal.scrollTop(terminal.prop('scrollHeight'))
})
// ready
form.appendTo('#launcher')
$('input').trigger('change')