-
Notifications
You must be signed in to change notification settings - Fork 505
/
call-stack.jsx
43 lines (35 loc) · 1.11 KB
/
call-stack.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
var React = require('react/addons');
var ReactCSSTransitionGroup = React.addons.CSSTransitionGroup;
var CallStackItem = require('./call-stack-item.jsx');
var EventsMixin = require('react-backbone-events-mixin');
module.exports = React.createClass({
mixins: [
EventsMixin
],
registerListeners: function (props, state) {
var self = this;
this.listenTo(state.stack, 'all', function () {
self.forceUpdate();
});
},
getInitialState: function () {
return {
stack: window.app.store.callstack
};
},
render: function () {
var calls = [];
this.state.stack.each(function (call) {
calls.unshift(<CallStackItem key={call._key} isCallback={call.isCallback}>{call.code}</CallStackItem>);
});
return (
<div className="stack-wrapper flexChild">
<div className="stack">
<ReactCSSTransitionGroup transitionName="tr-stack">
{calls}
</ReactCSSTransitionGroup>
</div>
</div>
);
}
});