Skip to content

Commit 5b02024

Browse files
authored
Merge pull request #54 from htmlacademy/feature/add-custom-event
Добавляет кастомное событие, вызывающееся при выводе сообщения в конс…
2 parents 9d4e8c3 + 14be2f2 commit 5b02024

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/console.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ export default class Console {
4141

4242
this.addConfig(config);
4343
this.params.global.TypedArray = Object.getPrototypeOf(Int8Array);
44+
this.container = container;
45+
this.customEvent = new Event(`console-outputs`);
4446
}
4547

4648
addConfig(config = {}) {
@@ -210,6 +212,7 @@ export default class Console {
210212
values.forEach((val) => {
211213
rowEl.appendChild(this.createTypedView(val, mode).el);
212214
});
215+
this.container.dispatchEvent(new CustomEvent(`console-outputs`));
213216
this._el.appendChild(rowEl);
214217
if (onPrint) {
215218
onPrint(rowEl);

0 commit comments

Comments
 (0)