Przeglądaj źródła

Breaking change: api.modal.create no longer takes class

Instead it takes the name of a custom DOM element to invoke.
JC Brand 1 rok temu
rodzic
commit
7aeb6c7afd
2 zmienionych plików z 3 dodań i 10 usunięć
  1. 1 0
      CHANGES.md
  2. 2 10
      src/plugins/modal/api.js

+ 1 - 0
CHANGES.md

@@ -16,6 +16,7 @@
   `CustomElement` are not on `_converse.exports`.
 - The `windowStateChanged` event has been removed. If you used it, rely on the
   `visibilitychange` event on `document` instead.
+- `api.modal.create` no longer takes a class, instead it takes the name of a custom DOM element.
 
 ## 10.1.6 (2023-08-31)
 

+ 2 - 10
src/plugins/modal/api.js

@@ -50,16 +50,8 @@ const modal_api = {
          *  set on the modal instance.
          */
         create (name, properties) {
-            let modal;
-            if (typeof name === 'string') {
-                const ModalClass = customElements.get(name);
-                modal = modals_map[name] = new ModalClass(properties);
-            } else {
-                // Legacy...
-                const ModalClass = name;
-                modal = new ModalClass(properties);
-                modals.push(modal);
-            }
+            const ModalClass = customElements.get(name);
+            const modal = modals_map[name] = new ModalClass(properties);
             return modal;
         },