parent
28c32745fd
commit
aba9c8de14
@ -1,39 +1,21 @@ |
|||||||
'use strict' |
'use strict' |
||||||
var DropdownPanel = require('./DropdownPanel') |
var DropdownPanel = require('./DropdownPanel') |
||||||
var remixLib = require('remix-lib') |
|
||||||
var ui = remixLib.helpers.ui |
|
||||||
var yo = require('yo-yo') |
var yo = require('yo-yo') |
||||||
|
|
||||||
function MemoryPanel (_parent, _traceManager) { |
function MemoryPanel () { |
||||||
this.parent = _parent |
|
||||||
this.traceManager = _traceManager |
|
||||||
this.basicPanel = new DropdownPanel('Memory', { |
this.basicPanel = new DropdownPanel('Memory', { |
||||||
json: true, |
json: true, |
||||||
css: { |
css: { |
||||||
'font-family': 'monospace' |
'font-family': 'monospace' |
||||||
}}) |
}}) |
||||||
this.init() |
|
||||||
} |
} |
||||||
|
|
||||||
MemoryPanel.prototype.render = function () { |
MemoryPanel.prototype.update = function (calldata) { |
||||||
return yo`<div id='memorypanel' >${this.basicPanel.render()}</div>` |
this.basicPanel.update(calldata) |
||||||
} |
} |
||||||
|
|
||||||
MemoryPanel.prototype.init = function () { |
MemoryPanel.prototype.render = function () { |
||||||
var self = this |
return yo`<div id='memorypanel' >${this.basicPanel.render()}</div>` |
||||||
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) |
|
||||||
self.basicPanel.update({}) |
|
||||||
} else if (self.parent.currentStepIndex === index) { |
|
||||||
self.basicPanel.update(ui.formatMemory(memory, 16)) |
|
||||||
} |
|
||||||
}) |
|
||||||
}) |
|
||||||
} |
} |
||||||
|
|
||||||
module.exports = MemoryPanel |
module.exports = MemoryPanel |
||||||
|
Loading…
Reference in new issue