Fire event for when popup is toggled.
This commit is contained in:
parent
721f2a4f4a
commit
3af695daab
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@tp/tp-popup",
|
||||
"version": "1.0.4",
|
||||
"version": "1.0.5",
|
||||
"description": "",
|
||||
"main": "tp-popup.js",
|
||||
"scripts": {
|
||||
|
@ -117,6 +117,13 @@ class TpPopup extends EventHelpers(Position(DomQuery(LitElement))) {
|
||||
this.listen(this, 'click', '_onClick');
|
||||
}
|
||||
|
||||
updated(changes) {
|
||||
// Fire event only if isOpen wasn't undefined before. Otherwise an event is fired at the first render.
|
||||
if (changes.has('isOpen') && changes.get('isOpen') !== undefined) {
|
||||
this.dispatchEvent(new CustomEvent('is-open-changed', { detail: this.isOpen, bubbles: true, composed: true }));
|
||||
}
|
||||
}
|
||||
|
||||
disconnectedCallback() {
|
||||
super.disconnectedCallback();
|
||||
this._cleanupEvents();
|
||||
|
Loading…
Reference in New Issue
Block a user