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.
8 * List of displayed logs.
22 isScrollAtBottom_
: true,
25 * Called after the Polymer element is initialized.
28 this.$.list
.onscroll
= this.onScroll_
.bind(this);
29 this.async(this.scrollToBottom_
);
33 * Called when the list of logs change.
35 logsChanged: function(oldValue
, newValue
) {
36 if (this.isScrollAtBottom_
)
37 this.async(this.scrollToBottom_
);
44 clearLogs_: function() {
45 this.$.logBuffer
.clearLogs();
49 * Event handler when the list is scrolled.
52 onScroll_: function() {
53 var list
= this.$.list
;
54 this.isScrollAtBottom_
=
55 list
.scrollTop
+ list
.offsetHeight
== list
.scrollHeight
;
59 * Scrolls the logs container to the bottom.
62 scrollToBottom_: function() {
63 this.$.list
.scrollTop
= this.$.list
.scrollHeight
;
67 * @param {string} filename
68 * @return {string} The filename stripped of its preceeding path.
71 stripPath_: function(filename
) {
72 var directories
= filename
.split('/');
73 return directories
[directories
.length
- 1];