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/MemoryPanel.js

40 lines
1.0 KiB

'use strict'
8 years ago
var DropdownPanel = require('./DropdownPanel')
7 years ago
var remixLib = require('remix-lib')
var ui = remixLib.helpers.ui
var yo = require('yo-yo')
function MemoryPanel (_parent, _traceManager) {
this.parent = _parent
this.traceManager = _traceManager
this.basicPanel = new DropdownPanel('Memory', {
json: true,
css: {
'font-family': 'monospace'
}})
this.init()
}
MemoryPanel.prototype.render = function () {
9 years ago
return yo`<div id='memorypanel' >${this.basicPanel.render()}</div>`
}
MemoryPanel.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.getMemoryAt(index, function (error, memory) {
if (error) {
console.log(error)
8 years ago
self.basicPanel.update({})
} else if (self.parent.currentStepIndex === index) {
7 years ago
self.basicPanel.update(ui.formatMemory(memory, 16))
}
})
})
}
module.exports = MemoryPanel