-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show binding changes #263
Show binding changes #263
Changes from 6 commits
2cacb7a
4a62164
f8aa3e4
35693e0
fe1f05b
6edaaf2
a195261
aa4870c
61b15e0
e25b8ad
7961783
1856291
c8280d6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,8 @@ | |
<div class='console-actions'> | ||
<div class='close-button button' title='close'>x</div> | ||
</div> | ||
<div class='console-inner'></div> | ||
<div class='console-inner'> | ||
<div class='console-notifications'></div> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we really need the extra layout here? What's so special about the notifications, they look like a regular console line to me. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Initially I had the I have changed it to append before the lastChild of the |
||
</div> | ||
</div> | ||
<input class='clipboard' type='text'> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -864,11 +864,23 @@ REPLConsole.prototype.scrollToBottom = function() { | |
this.outer.scrollTop = this.outer.scrollHeight; | ||
}; | ||
|
||
// Change the binding of the console | ||
/** | ||
* Change the binding of the console | ||
* Also updates a div to show that it has been changed. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This may change, maybe we won't win a lot by changing the comment here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense, I'll revert the change here |
||
*/ | ||
REPLConsole.prototype.switchBindingTo = function(frameId, callback) { | ||
var url = this.getSessionUrl('trace'); | ||
var params = "frame_id=" + encodeURIComponent(frameId); | ||
postRequest(url, params, callback); | ||
var notification = document.createElement('div'); | ||
var _this = this; | ||
|
||
notification.className = "console-notification"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. var notification = document.createElement('div');
notification.className = "console-notification";
var _this = this;
postRequest(url, params, function() { Can we keep the flow like this here? The operations are "grouped" this way. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sure! |
||
postRequest(url, params, function() { | ||
notification.innerHTML = "Binding has changed to: " + callback(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm thinking whether we call this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I initially had it as Context as well but renamed it last minute. I guess I can change it back! I agree it sounds more "intuitive" for people using web-console. |
||
var lastPrompt = findLastChild(_this.inner, "console-prompt-box"); | ||
_this.inner.insertBefore(notification, lastPrompt); | ||
_this.scrollToBottom(); | ||
}); | ||
}; | ||
|
||
/** | ||
|
@@ -946,6 +958,14 @@ function removeAllChildren(el) { | |
} | ||
} | ||
|
||
function findLastChild(el, className) { | ||
for (var i = el.childNodes.length - 1; i > 0; -- i) { | ||
if (hasClass(el.childNodes[i], className)) { | ||
return el.childNodes[i]; | ||
} | ||
} | ||
} | ||
|
||
function findChild(el, className) { | ||
for (var i = 0; i < el.childNodes.length; ++ i) { | ||
if (hasClass(el.childNodes[i], className)) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may drop this diff change as well, e.g. leave it as before: