Skip to content

Commit

Permalink
Simplify editorUndoBar fields and constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
ryzokuken committed Oct 16, 2024
1 parent 26d400f commit a4130d0
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions web/editor_undo_bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,10 @@
*/

class EditorUndoBar {
#boundHide = this.hide.bind(this);

#closeButton;

#container;

#controller = null;

#eventBus;

isOpen = false;

#message;
Expand All @@ -34,14 +28,13 @@ class EditorUndoBar {
this.#container = container;
this.#message = message;
this.#undoButton = undoButton;
this.#closeButton = closeButton;
this.#eventBus = eventBus;

// Caveat: we have to pick between registering these everytime the bar is
// shown and not having the ability to cleanup using AbortController.
this.#closeButton.addEventListener("click", this.#boundHide);
this.#eventBus.on("print", this.#boundHide);
this.#eventBus.on("download", this.#boundHide);
const boundHide = this.hide.bind(this);
closeButton.addEventListener("click", boundHide);
eventBus._on("beforeprint", boundHide);
eventBus._on("download", boundHide);
}

show(action, type) {
Expand Down

0 comments on commit a4130d0

Please sign in to comment.