Skip to content

Commit

Permalink
fix(overlays): dismiss last overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
manucorporat committed Aug 25, 2018
1 parent 8bf60e7 commit c1c5102
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 15 deletions.
14 changes: 7 additions & 7 deletions core/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export namespace Components {
/**
* Dismiss the open action sheet overlay.
*/
'dismiss': (data?: any, role?: string | undefined, actionSheetId?: number) => Promise<void>;
'dismiss': (data?: any, role?: string | undefined, actionSheetId?: number | undefined) => Promise<void>;
/**
* Get the most recently opened action sheet overlay.
*/
Expand Down Expand Up @@ -223,7 +223,7 @@ export namespace Components {
/**
* Dismiss the open alert overlay.
*/
'dismiss': (data?: any, role?: string | undefined, alertId?: number) => Promise<void>;
'dismiss': (data?: any, role?: string | undefined, alertId?: number | undefined) => Promise<void>;
/**
* Get the most recently opened alert overlay.
*/
Expand Down Expand Up @@ -2229,7 +2229,7 @@ export namespace Components {
/**
* Dismiss the open loading overlay.
*/
'dismiss': (data?: any, role?: string | undefined, loadingId?: number) => Promise<void>;
'dismiss': (data?: any, role?: string | undefined, loadingId?: number | undefined) => Promise<void>;
/**
* Get the most recently opened loading overlay.
*/
Expand Down Expand Up @@ -2572,7 +2572,7 @@ export namespace Components {
/**
* Dismiss the open modal overlay.
*/
'dismiss': (data?: any, role?: string | undefined, modalId?: number) => Promise<void>;
'dismiss': (data?: any, role?: string | undefined, modalId?: number | undefined) => Promise<void>;
/**
* Get the most recently opened modal overlay.
*/
Expand Down Expand Up @@ -2880,7 +2880,7 @@ export namespace Components {

interface IonPickerController {
'create': (opts?: PickerOptions | undefined) => Promise<HTMLIonPickerElement>;
'dismiss': (data?: any, role?: string | undefined, pickerId?: number) => Promise<void>;
'dismiss': (data?: any, role?: string | undefined, pickerId?: number | undefined) => Promise<void>;
'getTop': () => HTMLIonPickerElement;
}
interface IonPickerControllerAttributes extends StencilHTMLAttributes {}
Expand Down Expand Up @@ -3024,7 +3024,7 @@ export namespace Components {
/**
* Dismiss the open popover overlay.
*/
'dismiss': (data?: any, role?: string | undefined, popoverId?: number) => Promise<void>;
'dismiss': (data?: any, role?: string | undefined, popoverId?: number | undefined) => Promise<void>;
/**
* Get the most recently opened popover overlay.
*/
Expand Down Expand Up @@ -4861,7 +4861,7 @@ export namespace Components {
/**
* Dismiss the open toast overlay.
*/
'dismiss': (data?: any, role?: string | undefined, toastId?: number) => Promise<void>;
'dismiss': (data?: any, role?: string | undefined, toastId?: number | undefined) => Promise<void>;
/**
* Get the most recently opened toast overlay.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class ActionSheetController implements OverlayController {
* Dismiss the open action sheet overlay.
*/
@Method()
dismiss(data?: any, role?: string, actionSheetId = -1) {
dismiss(data?: any, role?: string, actionSheetId?: number) {
return dismissOverlay(this.doc, data, role, 'ion-action-sheet', actionSheetId);
}

Expand Down
2 changes: 1 addition & 1 deletion core/src/components/alert-controller/alert-controller.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class AlertController implements OverlayController {
* Dismiss the open alert overlay.
*/
@Method()
dismiss(data?: any, role?: string, alertId = -1) {
dismiss(data?: any, role?: string, alertId?: number) {
return dismissOverlay(this.doc, data, role, 'ion-alert', alertId);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class LoadingController implements OverlayController {
* Dismiss the open loading overlay.
*/
@Method()
dismiss(data?: any, role?: string, loadingId = -1) {
dismiss(data?: any, role?: string, loadingId?: number) {
return dismissOverlay(this.doc, data, role, 'ion-loading', loadingId);
}

Expand Down
2 changes: 1 addition & 1 deletion core/src/components/modal-controller/modal-controller.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class ModalController implements OverlayController {
* Dismiss the open modal overlay.
*/
@Method()
dismiss(data?: any, role?: string, modalId = -1) {
dismiss(data?: any, role?: string, modalId?: number) {
return dismissOverlay(this.doc, data, role, 'ion-modal', modalId);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class PickerController implements OverlayController {
* Dismiss the open picker overlay.
*/
@Method()
dismiss(data?: any, role?: string, pickerId = -1) {
dismiss(data?: any, role?: string, pickerId?: number) {
return dismissOverlay(this.doc, data, role, 'ion-picker', pickerId);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class PopoverController implements OverlayController {
* Dismiss the open popover overlay.
*/
@Method()
dismiss(data?: any, role?: string, popoverId = -1) {
dismiss(data?: any, role?: string, popoverId?: number) {
return dismissOverlay(this.doc, data, role, 'ion-popover', popoverId);
}

Expand Down
2 changes: 1 addition & 1 deletion core/src/components/toast-controller/toast-controller.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class ToastController implements OverlayController {
* Dismiss the open toast overlay.
*/
@Method()
dismiss(data?: any, role?: string, toastId = -1) {
dismiss(data?: any, role?: string, toastId?: number) {
return dismissOverlay(this.doc, data, role, 'ion-toast', toastId);
}

Expand Down
2 changes: 1 addition & 1 deletion core/src/utils/overlays.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export function connectListeners(doc: Document) {
}
}

export function dismissOverlay(doc: Document, data: any, role: string | undefined, overlayTag: string, id: number): Promise<void> {
export function dismissOverlay(doc: Document, data: any, role: string | undefined, overlayTag: string, id?: number): Promise<void> {
const overlay = getOverlay(doc, overlayTag, id);
if (!overlay) {
return Promise.reject('overlay does not exist');
Expand Down

0 comments on commit c1c5102

Please sign in to comment.