|
|
@ -24,9 +24,11 @@ function register (api) { KONSOLES.push(api) } |
|
|
|
var ghostbar = yo`<div class=${css.ghostbar}></div>` |
|
|
|
var ghostbar = yo`<div class=${css.ghostbar}></div>` |
|
|
|
|
|
|
|
|
|
|
|
class Terminal { |
|
|
|
class Terminal { |
|
|
|
constructor (opts = { auto: true }) { |
|
|
|
constructor (opts, api) { |
|
|
|
var self = this |
|
|
|
var self = this |
|
|
|
self.event = new EventManager() |
|
|
|
self.event = new EventManager() |
|
|
|
|
|
|
|
self._api = api |
|
|
|
|
|
|
|
self._opts = opts |
|
|
|
self.data = { |
|
|
|
self.data = { |
|
|
|
lineLength: opts.lineLength || 80, |
|
|
|
lineLength: opts.lineLength || 80, |
|
|
|
session: [], |
|
|
|
session: [], |
|
|
@ -72,7 +74,7 @@ class Terminal { |
|
|
|
self.registerCommand('script', function execute (args, scopedCommands, append) { |
|
|
|
self.registerCommand('script', function execute (args, scopedCommands, append) { |
|
|
|
var script = String(args[0]) |
|
|
|
var script = String(args[0]) |
|
|
|
scopedCommands.log(`> ${script}`) |
|
|
|
scopedCommands.log(`> ${script}`) |
|
|
|
if (self._api.cmdInterpreter && self._api.cmdInterpreter.interpret(script)) return |
|
|
|
if (self._opts.cmdInterpreter && self.opts.cmdInterpreter.interpret(script)) return |
|
|
|
self._shell(script, scopedCommands, function (error, output) { |
|
|
|
self._shell(script, scopedCommands, function (error, output) { |
|
|
|
if (error) scopedCommands.error(error) |
|
|
|
if (error) scopedCommands.error(error) |
|
|
|
else scopedCommands.log(output) |
|
|
|
else scopedCommands.log(output) |
|
|
@ -110,7 +112,7 @@ class Terminal { |
|
|
|
self._view.dragbar = yo` |
|
|
|
self._view.dragbar = yo` |
|
|
|
<div onmousedown=${mousedown} class=${css.dragbarHorizontal}></div>` |
|
|
|
<div onmousedown=${mousedown} class=${css.dragbarHorizontal}></div>` |
|
|
|
self._view.dropdown = self._components.dropdown.render() |
|
|
|
self._view.dropdown = self._components.dropdown.render() |
|
|
|
self._view.pendingTxCount = yo`<div class=${css.pendingTx} title='Pending Transactions'>${self._view.pendingTxCount}</div>` |
|
|
|
self._view.pendingTxCount = yo`<div class=${css.pendingTx} title='Pending Transactions'>0</div>` |
|
|
|
self._view.bar = yo` |
|
|
|
self._view.bar = yo` |
|
|
|
<div class=${css.bar}> |
|
|
|
<div class=${css.bar}> |
|
|
|
${self._view.dragbar} |
|
|
|
${self._view.dragbar} |
|
|
@ -134,6 +136,9 @@ class Terminal { |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
` |
|
|
|
` |
|
|
|
|
|
|
|
setInterval(() => { |
|
|
|
|
|
|
|
self._view.pendingTxCount.innerHTML = self._opts.udapp.pendingTransactionsCount() |
|
|
|
|
|
|
|
}, 1000) |
|
|
|
|
|
|
|
|
|
|
|
function listenOnNetwork (ev) { |
|
|
|
function listenOnNetwork (ev) { |
|
|
|
self.event.trigger('listenOnNetWork', [ev.currentTarget.checked]) |
|
|
|
self.event.trigger('listenOnNetWork', [ev.currentTarget.checked]) |
|
|
|