Ver código fonte

docs: BytmDialog docs

Sven 1 ano atrás
pai
commit
bd1c09055c
2 arquivos alterados com 11 adições e 11 exclusões
  1. 5 5
      contributing.md
  2. 6 6
      src/components/BytmDialog.ts

+ 5 - 5
contributing.md

@@ -975,11 +975,11 @@ The usage and example blocks on each are written in TypeScript but can be used i
 > Events:  
 > | Event | Description |
 > | :--- | :--- |
-> | on(`close`, () => void) | Called just after the dialog is closed |
-> | on(`open`, () => void) | Called just after the dialog is opened |
-> | on(`render`, () => void) | Called just after the dialog contents are rendered |
-> | on(`clear`, () => void) | Called just after the dialog contents are cleared |
-> | on(`destroy`, () => void) | Called just before the dialog is destroyed and all listeners are removed |
+> | `on("close", () => void)` | Called just **after** the dialog is closed |
+> | `on("open", () => void)` | Called just **after** the dialog is opened |
+> | `on("render", () => void)` | Called just **after** the dialog contents are rendered |
+> | `on("clear", () => void)` | Called just **after** the dialog contents are cleared |
+> | `on("destroy", () => void)` | Called just **after** the dialog is destroyed and **before** all listeners are removed |
 > 
 > <details><summary><b>Example <i>(click to expand)</i></b></summary>
 > 

+ 6 - 6
src/components/BytmDialog.ts

@@ -36,15 +36,15 @@ let lastDialogId: string | null = null;
 
 /** Creates and manages a modal dialog element */
 export class BytmDialog extends NanoEmitter<{
-  /** Emitted just after the dialog is closed */
+  /** Emitted just **after** the dialog is closed */
   close: () => void;
-  /** Emitted just after the dialog is opened */
+  /** Emitted just **after** the dialog is opened */
   open: () => void;
-  /** Emitted just after the dialog contents are rendered */
+  /** Emitted just **after** the dialog contents are rendered */
   render: () => void;
-  /** Emitted just after the dialog contents are cleared */
+  /** Emitted just **after** the dialog contents are cleared */
   clear: () => void;
-  /** Emitted just before the dialog is destroyed and all listeners are removed */
+  /** Emitted just **after** the dialog is destroyed and **before** all listeners are removed */
   destroy: () => void;
 }> {
   public readonly options;
@@ -201,8 +201,8 @@ export class BytmDialog extends NanoEmitter<{
 
   /** Clears the DOM of the dialog and removes all event listeners */
   public destroy() {
-    this.events.emit("destroy");
     this.unmount();
+    this.events.emit("destroy");
     this.unsubscribeAll();
   }