Browse Source

docs: better Dialog documentation

Sv443 5 months ago
parent
commit
1fb930f05b
1 changed files with 10 additions and 3 deletions
  1. 10 3
      README.md

+ 10 - 3
README.md

@@ -1403,25 +1403,28 @@ The options object has the following properties:
 #### `Dialog.open()`
 #### `Dialog.open()`
 Usage: `open(): Promise<void>`  
 Usage: `open(): Promise<void>`  
 Opens the dialog.  
 Opens the dialog.  
+If the dialog is not mounted yet, it will be mounted before opening.  
 
 
 <br>
 <br>
 
 
 #### `Dialog.close()`
 #### `Dialog.close()`
 Usage: `close(): void`  
 Usage: `close(): void`  
 Closes the dialog.  
 Closes the dialog.  
+If `options.destroyOnClose` is set to `true`, [`Dialog.destroy()`](#dialogdestroy) will be called immediately after closing.
 
 
 <br>
 <br>
 
 
 #### `Dialog.mount()`
 #### `Dialog.mount()`
 Usage: `mount(): Promise<void>`  
 Usage: `mount(): Promise<void>`  
 Mounts the dialog to the DOM by calling the render functions provided in the options object.  
 Mounts the dialog to the DOM by calling the render functions provided in the options object.  
-Can be done before opening the dialog to avoid a delay.  
+After calling, the dialog will exist in the DOM but will be invisible until [`Dialog.open()`](#dialogopen) is called.  
+Call this before opening the dialog to avoid a rendering delay.  
 
 
 <br>
 <br>
 
 
 #### `Dialog.unmount()`
 #### `Dialog.unmount()`
 Usage: `unmount(): void`  
 Usage: `unmount(): void`  
-Unmounts the dialog from the DOM.  
+Closes the dialog first if it's open, then removes it from the DOM.  
 
 
 <br>
 <br>
 
 
@@ -1448,7 +1451,7 @@ Returns `true` if the dialog is mounted, else `false`.
 #### `Dialog.destroy()`
 #### `Dialog.destroy()`
 Usage: `destroy(): void`  
 Usage: `destroy(): void`  
 Destroys the dialog.  
 Destroys the dialog.  
-Removes all listeners and unmounts the dialog by default.  
+Removes all listeners by default and closes and unmounts the dialog.  
 
 
 <br>
 <br>
 
 
@@ -1505,6 +1508,10 @@ fooDialog.on("close", () => {
   console.log("Dialog closed");
   console.log("Dialog closed");
 });
 });
 
 
+fooDialog.on("open", () => {
+  console.log("Currently open dialogs:", Dialog.getOpenDialogs());
+});
+
 fooDialog.open();
 fooDialog.open();
 ```
 ```
 </details>
 </details>