Skip to content

Commit

Permalink
little bit of styling + sending listener function declaration code ov…
Browse files Browse the repository at this point in the history
…er, however not used
  • Loading branch information
Patrick Brosset committed Nov 4, 2014
1 parent daac164 commit 4529b53
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 10 deletions.
14 changes: 12 additions & 2 deletions data/panel.css
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ body {
padding: 5px 3px;
margin: 0;
list-style-type: none;

overflow: auto;
}

.record:hover {
Expand All @@ -101,17 +103,25 @@ body {
color: white;
}

.record.event:not(:hover) {
.event-name {
color: orange;
font-weight: bold;
}

.record:hover .event-name {
color: white;
}

.target {
float: right;
cursor: pointer;
}

.time {
color: #999;
color: #666;
margin-right: 5px;
float: left;
width: 5%;
}

.target-tag {
Expand Down
3 changes: 2 additions & 1 deletion data/panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,8 @@ RecorderPanel.prototype = {

buildRecordOutputFor_event({parentEl, data, time}) {
let outputEl = this.doc.createElement("span");
outputEl.textContent = "Event " + data.type;
outputEl.innerHTML = "Event <span class='event-name'>" + data.type +
"</span> handled";
parentEl.appendChild(outputEl);
},

Expand Down
22 changes: 15 additions & 7 deletions data/recorder-frame-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,13 @@ PageChangeRecorder.prototype = {
// Add one system-group event listener per default event type found
// so we can be called whenever one happens even if the handler prevents
// propagation.
for (let {type} of listeners) {
els.addSystemEventListener(node, type, this._onEvent, true);
for (let listener of listeners) {
let {type, listenerObject} = listener.listener;
let onEvent = e => {
this._onEvent(e.type, e.target, listenerObject + "");
};
els.addSystemEventListener(node, type, onEvent, true);
listener.cb = onEvent;
}
}
},
Expand All @@ -64,8 +69,8 @@ PageChangeRecorder.prototype = {
this.isStarted = false;

for (let [node, listeners] of this.addedListeners) {
for (let {type} of listeners) {
els.removeSystemEventListener(node, type, this._onEvent, true);
for (let {cb, listener} of listeners) {
els.removeSystemEventListener(node, listeber.type, cb, true);
}
}
this.addedListenerTypes = null;
Expand All @@ -82,7 +87,10 @@ PageChangeRecorder.prototype = {
if (!nodeEventListeners.has(node)) {
nodeEventListeners.set(node, []);
}
nodeEventListeners.get(node).push(listener);
nodeEventListeners.get(node).push({
listener: listener,
cb: null
});
}
}
return nodeEventListeners;
Expand Down Expand Up @@ -118,8 +126,8 @@ PageChangeRecorder.prototype = {
}
},

_onEvent({type, target}) {
this._emitChange("event", {type, target});
_onEvent(type, target, functionDeclaration) {
this._emitChange("event", {type, target, functionDeclaration});
},

_emitChange(type, data) {
Expand Down

0 comments on commit 4529b53

Please sign in to comment.