added two apps, and better implementation
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import { messageListener } from "../../../shared/message-listener";
|
||||
import { BaseElement } from "../_base";
|
||||
import { NotificationBubble } from "./notification-bubble";
|
||||
import './notification-bubbles.less';
|
||||
|
||||
export class NotificationBubbles extends BaseElement {
|
||||
add(text: string, type: 'log' | 'info' | 'warn' | 'error' | 'syntax-error' | 'script' | 'time' | 'response') {
|
||||
|
||||
if (text && type) {
|
||||
var bubble = <NotificationBubble>document.createElement("notification-bubble");
|
||||
bubble.innerText = text;
|
||||
bubble.classList.add(type);
|
||||
this.appendChild(bubble);
|
||||
|
||||
if (this.children.length > 50) {
|
||||
this.removeChild(this.children[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
reset() {
|
||||
this.innerHTML = "";
|
||||
}
|
||||
|
||||
onInit(): void {
|
||||
messageListener((type, value) => {
|
||||
if (type != 'script' && type != 'response')
|
||||
this.add(value, type);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user