add guard to show/hide methods

pull/463/head
Cory LaViska 2021-05-26 12:43:30 -04:00
rodzic ee9ce8a87b
commit fc5a21f57d
5 zmienionych plików z 10 dodań i 10 usunięć

Wyświetl plik

@ -74,7 +74,7 @@ export default class SlAlert extends LitElement {
/** Shows the alert. */ /** Shows the alert. */
async show() { async show() {
if (!this.hasInitialized) { if (!this.hasInitialized || this.open) {
return; return;
} }
@ -100,7 +100,7 @@ export default class SlAlert extends LitElement {
/** Hides the alert */ /** Hides the alert */
async hide() { async hide() {
if (!this.hasInitialized) { if (!this.hasInitialized || !this.open) {
return; return;
} }

Wyświetl plik

@ -82,7 +82,7 @@ export default class SlDetails extends LitElement {
/** Shows the alert. */ /** Shows the alert. */
async show() { async show() {
if (!this.hasInitialized || this.disabled) { if (!this.hasInitialized || this.open || this.disabled) {
return; return;
} }
@ -106,7 +106,7 @@ export default class SlDetails extends LitElement {
/** Hides the alert */ /** Hides the alert */
async hide() { async hide() {
// Prevent subsequent calls to the method, whether manually or triggered by the `open` watcher // Prevent subsequent calls to the method, whether manually or triggered by the `open` watcher
if (!this.hasInitialized || this.disabled) { if (!this.hasInitialized || !this.open || this.disabled) {
return; return;
} }

Wyświetl plik

@ -118,7 +118,7 @@ export default class SlDialog extends LitElement {
/** Shows the dialog */ /** Shows the dialog */
async show() { async show() {
if (!this.hasInitialized) { if (!this.hasInitialized || this.open) {
return; return;
} }
@ -166,7 +166,7 @@ export default class SlDialog extends LitElement {
/** Hides the dialog */ /** Hides the dialog */
async hide() { async hide() {
if (!this.hasInitialized) { if (!this.hasInitialized || !this.open) {
return; return;
} }

Wyświetl plik

@ -132,7 +132,7 @@ export default class SlDrawer extends LitElement {
/** Shows the drawer */ /** Shows the drawer */
async show() { async show() {
if (!this.hasInitialized) { if (!this.hasInitialized || this.open) {
return; return;
} }
@ -183,7 +183,7 @@ export default class SlDrawer extends LitElement {
/** Hides the drawer */ /** Hides the drawer */
async hide() { async hide() {
if (!this.hasInitialized) { if (!this.hasInitialized || !this.open) {
return; return;
} }

Wyświetl plik

@ -332,7 +332,7 @@ export default class SlDropdown extends LitElement {
/** Shows the dropdown panel */ /** Shows the dropdown panel */
async show() { async show() {
// Prevent subsequent calls to the method, whether manually or triggered by the `open` watcher // Prevent subsequent calls to the method, whether manually or triggered by the `open` watcher
if (!this.hasInitialized) { if (!this.hasInitialized || this.open) {
return; return;
} }
@ -360,7 +360,7 @@ export default class SlDropdown extends LitElement {
/** Hides the dropdown panel */ /** Hides the dropdown panel */
async hide() { async hide() {
// Prevent subsequent calls to the method, whether manually or triggered by the `open` watcher // Prevent subsequent calls to the method, whether manually or triggered by the `open` watcher
if (!this.hasInitialized) { if (!this.hasInitialized || !this.open) {
return; return;
} }