implement clear function for js8, too - refs #187

This commit is contained in:
Jakob Ketterl
2020-12-09 21:19:22 +01:00
parent aa66e69c15
commit 9e45cfd02a
4 changed files with 31 additions and 8 deletions

View File

@ -100,7 +100,13 @@ Js8Thread.prototype.purgeOldMessages = function() {
return this.messages.length;
};
Js8Thread.prototype.purge = function() {
this.message = [];
this.el.remove();
};
Js8Threader = function(el){
MessagePanel.call(this, el);
this.threads = [];
this.tbody = $(el).find('tbody');
var me = this;
@ -109,6 +115,28 @@ Js8Threader = function(el){
}, 15000);
};
Js8Threader.prototype = new MessagePanel();
Js8Threader.prototype.render = function() {
$(this.el).append($(
'<table>' +
'<thead><tr>' +
'<th>UTC</th>' +
'<th class="decimal freq">Freq</th>' +
'<th class="message">Message</th>' +
'</tr></thead>' +
'<tbody></tbody>' +
'</table>'
));
};
Js8Threader.prototype.clearMessages = function() {
this.threads.forEach(function(t) {
t.purge();
});
this.threads = [];
};
Js8Threader.prototype.purgeOldMessages = function() {
this.threads = this.threads.filter(function(t) {
return t.purgeOldMessages();