Selaa lähdekoodia

Assign the Skeletor Events API to CustomElement

So that components can use `listenTo`
JC Brand 5 vuotta sitten
vanhempi
commit
2cb1af3dea
1 muutettua tiedostoa jossa 11 lisäystä ja 0 poistoa
  1. 11 0
      src/components/element.js

+ 11 - 0
src/components/element.js

@@ -1,9 +1,20 @@
 import { LitElement } from 'lit-element';
+import { Events } from '@converse/skeletor/src/events.js';
+
 
 export class CustomElement extends LitElement {
 
+    constructor () {
+        super();
+        Object.assign(this, Events);
+    }
+
     createRenderRoot () {
         // Render without the shadow DOM
         return this;
     }
+
+    disconnectedCallback () {
+        this.stopListening();
+    }
 }