remix-project mirror
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
remix-project/remix-debugger/src/ui/StackPanel.js

34 lines
895 B

'use strict'
8 years ago
var DropdownPanel = require('./DropdownPanel')
var yo = require('yo-yo')
function StackPanel (_parent, _traceManager) {
this.parent = _parent
this.traceManager = _traceManager
this.basicPanel = new DropdownPanel('Stack', {json: true})
this.init()
}
StackPanel.prototype.render = function () {
9 years ago
return yo`<div id='stackpanel' >${this.basicPanel.render()}</div>`
}
StackPanel.prototype.init = function () {
var self = this
this.parent.event.register('indexChanged', this, function (index) {
if (index < 0) return
if (self.parent.currentStepIndex !== index) return
self.traceManager.getStackAt(index, function (error, stack) {
if (error) {
8 years ago
self.basicPanel.update({})
console.log(error)
} else if (self.parent.currentStepIndex === index) {
self.basicPanel.update(stack)
}
})
})
}
module.exports = StackPanel