1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
9 * List of displayed logs.
20 'logsChanged_(logs.*)',
27 isScrollAtBottom_
: true,
30 * Called after the Polymer element is initialized.
33 this.$.list
.onscroll
= this.onScroll_
.bind(this);
34 this.async(this.scrollToBottom_
);
38 * Called when the list of logs change.
40 logsChanged_: function() {
41 if (this.isScrollAtBottom_
)
42 this.async(this.scrollToBottom_
);
49 clearLogs_: function() {
50 this.$.logBuffer
.clearLogs();
54 * Event handler when the list is scrolled.
57 onScroll_: function() {
58 var list
= this.$.list
;
59 this.isScrollAtBottom_
=
60 list
.scrollTop
+ list
.offsetHeight
== list
.scrollHeight
;
64 * Scrolls the logs container to the bottom.
67 scrollToBottom_: function() {
68 this.$.list
.scrollTop
= this.$.list
.scrollHeight
;
72 * @param {LogMessage} log
73 * @return {string} The filename stripped of its preceeding path concatenated
74 * with the line number of the log.
77 computeFileAndLine_: function(log
) {
78 var directories
= log
.file
.split('/');
79 return directories
[directories
.length
- 1] + ':' + log
.line
;