import NoteContextAwareWidget from "./note_context_aware_widget.js"; const TPL = `
`; export default class ApiLogWidget extends NoteContextAwareWidget { isEnabled() { return this.note && this.note.mime.startsWith('application/javascript;env=') && super.isEnabled(); } doRender() { this.$widget = $(TPL); this.$widget.addClass("hidden-api-log"); this.$logContainer = this.$widget.find('.api-log-container'); } async refreshWithNote(note) { this.$logContainer.empty(); } apiLogMessagesEvent({messages, noteId}) { if (!this.isNote(noteId)) { return; } this.$widget.removeClass("hidden-api-log"); for (const message of messages) { this.$logContainer.append(message).append($("