From bf486e2c99c74db7dcaa752d7d46446f9fbe5f11 Mon Sep 17 00:00:00 2001 From: "Manu Mtz.-Almeida" Date: Fri, 7 Sep 2018 16:44:57 +0200 Subject: [PATCH] docs(overlay): onDidDismiss() and onWillDismiss() --- core/src/components.d.ts | 28 +++++++++---------- .../components/action-sheet/action-sheet.tsx | 9 ++---- core/src/components/action-sheet/readme.md | 12 ++++---- core/src/components/alert/alert.tsx | 8 ++---- core/src/components/alert/readme.md | 12 ++++---- core/src/components/loading/loading.tsx | 8 ++---- core/src/components/loading/readme.md | 12 ++++---- core/src/components/modal/modal.tsx | 8 ++---- core/src/components/modal/readme.md | 12 ++++---- core/src/components/picker/picker.tsx | 8 ++---- core/src/components/picker/readme.md | 14 +++++----- core/src/components/popover/popover.tsx | 10 ++----- core/src/components/popover/readme.md | 12 ++++---- core/src/components/toast/readme.md | 12 ++++---- core/src/utils/overlays.ts | 2 +- 15 files changed, 75 insertions(+), 92 deletions(-) diff --git a/core/src/components.d.ts b/core/src/components.d.ts index f1c538b2b3..7454fc1210 100644 --- a/core/src/components.d.ts +++ b/core/src/components.d.ts @@ -126,11 +126,11 @@ export namespace Components { */ 'mode': Mode; /** - * Returns a promise that resolves when the action-sheet did dismiss. It also accepts a callback that is called in the same circustances. + * Returns a promise that resolves when the action-sheet did dismiss. */ 'onDidDismiss': () => Promise>; /** - * Returns a promise that resolves when the action-sheet will dismiss. It also accepts a callback that is called in the same circustances. + * Returns a promise that resolves when the action-sheet will dismiss. */ 'onWillDismiss': () => Promise>; 'overlayIndex': number; @@ -285,11 +285,11 @@ export namespace Components { */ 'mode': Mode; /** - * Returns a promise that resolves when the alert did dismiss. It also accepts a callback that is called in the same circumstances. + * Returns a promise that resolves when the alert did dismiss. */ 'onDidDismiss': () => Promise>; /** - * Returns a promise that resolves when the alert will dismiss. It also accepts a callback that is called in the same circumstances. + * Returns a promise that resolves when the alert will dismiss. */ 'onWillDismiss': () => Promise>; 'overlayIndex': number; @@ -2291,11 +2291,11 @@ export namespace Components { */ 'mode': Mode; /** - * Returns a promise that resolves when the loading did dismiss. It also accepts a callback that is called in the same circumstances. + * Returns a promise that resolves when the loading did dismiss. */ 'onDidDismiss': () => Promise>; /** - * Returns a promise that resolves when the loading will dismiss. It also accepts a callback that is called in the same circumstances. + * Returns a promise that resolves when the loading will dismiss. */ 'onWillDismiss': () => Promise>; 'overlayIndex': number; @@ -2642,11 +2642,11 @@ export namespace Components { */ 'mode': Mode; /** - * Returns a promise that resolves when the modal did dismiss. It also accepts a callback that is called in the same circumstances. + * Returns a promise that resolves when the modal did dismiss. */ 'onDidDismiss': () => Promise>; /** - * Returns a promise that resolves when the modal will dismiss. It also accepts a callback that is called in the same circumstances. + * Returns a promise that resolves when the modal will dismiss. */ 'onWillDismiss': () => Promise>; 'overlayIndex': number; @@ -2963,11 +2963,11 @@ export namespace Components { */ 'mode': Mode; /** - * Returns a promise that resolves when the picker did dismiss. It also accepts a callback that is called in the same circustances. + * Returns a promise that resolves when the picker did dismiss. */ 'onDidDismiss': () => Promise>; /** - * Returns a promise that resolves when the picker will dismiss. It also accepts a callback that is called in the same circumstances. + * Returns a promise that resolves when the picker will dismiss. */ 'onWillDismiss': () => Promise>; 'overlayIndex': number; @@ -3115,11 +3115,11 @@ export namespace Components { */ 'mode': Mode; /** - * Returns a promise that resolves when the popover did dismiss. It also accepts a callback that is called in the same circustances. + * Returns a promise that resolves when the popover did dismiss. */ 'onDidDismiss': () => Promise>; /** - * Returns a promise that resolves when the popover will dismiss. It also accepts a callback that is called in the same circustances. + * Returns a promise that resolves when the popover will dismiss. */ 'onWillDismiss': () => Promise>; 'overlayIndex': number; @@ -4930,11 +4930,11 @@ export namespace Components { */ 'mode': Mode; /** - * Returns a promise that resolves when the toast did dismiss. It also accepts a callback that is called in the same circustances. + * Returns a promise that resolves when the toast did dismiss. */ 'onDidDismiss': () => Promise>; /** - * Returns a promise that resolves when the toast will dismiss. It also accepts a callback that is called in the same circustances. + * Returns a promise that resolves when the toast will dismiss. */ 'onWillDismiss': () => Promise>; 'overlayIndex': number; diff --git a/core/src/components/action-sheet/action-sheet.tsx b/core/src/components/action-sheet/action-sheet.tsx index 4144f6a0da..cd524d9901 100644 --- a/core/src/components/action-sheet/action-sheet.tsx +++ b/core/src/components/action-sheet/action-sheet.tsx @@ -125,7 +125,7 @@ export class ActionSheet implements OverlayInterface { @Listen('ionBackdropTap') protected onBackdropTap() { - return this.dismiss(null, BACKDROP); + return this.dismiss(undefined, BACKDROP); } @Listen('ionActionSheetWillDismiss') @@ -154,9 +154,7 @@ export class ActionSheet implements OverlayInterface { } /** - * Returns a promise that resolves when the action-sheet did dismiss. It also accepts a callback - * that is called in the same circustances. - * + * Returns a promise that resolves when the action-sheet did dismiss. */ @Method() onDidDismiss(): Promise { @@ -164,8 +162,7 @@ export class ActionSheet implements OverlayInterface { } /** - * Returns a promise that resolves when the action-sheet will dismiss. It also accepts a callback - * that is called in the same circustances. + * Returns a promise that resolves when the action-sheet will dismiss. * */ @Method() diff --git a/core/src/components/action-sheet/readme.md b/core/src/components/action-sheet/readme.md index cc73f3ed91..a7e2059c89 100644 --- a/core/src/components/action-sheet/readme.md +++ b/core/src/components/action-sheet/readme.md @@ -46,12 +46,12 @@ A button's `role` property can either be `destructive` or `cancel`. Buttons with ## Methods -| Method | Description | -| --------------- | --------------------------------------------------------------------------------------------------------------------------------------- | -| `dismiss` | Dismiss the action sheet overlay after it has been presented. | -| `onDidDismiss` | Returns a promise that resolves when the action-sheet did dismiss. It also accepts a callback that is called in the same circustances. | -| `onWillDismiss` | Returns a promise that resolves when the action-sheet will dismiss. It also accepts a callback that is called in the same circustances. | -| `present` | Present the action sheet overlay after it has been created. | +| Method | Description | +| --------------- | ------------------------------------------------------------------- | +| `dismiss` | Dismiss the action sheet overlay after it has been presented. | +| `onDidDismiss` | Returns a promise that resolves when the action-sheet did dismiss. | +| `onWillDismiss` | Returns a promise that resolves when the action-sheet will dismiss. | +| `present` | Present the action sheet overlay after it has been created. | ---------------------------------------------- diff --git a/core/src/components/alert/alert.tsx b/core/src/components/alert/alert.tsx index 7c295dd691..d1f18391e4 100644 --- a/core/src/components/alert/alert.tsx +++ b/core/src/components/alert/alert.tsx @@ -181,7 +181,7 @@ export class Alert implements OverlayInterface { @Listen('ionBackdropTap') protected onBackdropTap() { - return this.dismiss(null, BACKDROP); + return this.dismiss(undefined, BACKDROP); } @Listen('ionAlertWillDismiss') @@ -210,8 +210,7 @@ export class Alert implements OverlayInterface { } /** - * Returns a promise that resolves when the alert did dismiss. It also accepts a callback - * that is called in the same circumstances. + * Returns a promise that resolves when the alert did dismiss. * */ @Method() @@ -220,8 +219,7 @@ export class Alert implements OverlayInterface { } /** - * Returns a promise that resolves when the alert will dismiss. It also accepts a callback - * that is called in the same circumstances. + * Returns a promise that resolves when the alert will dismiss. * */ @Method() diff --git a/core/src/components/alert/readme.md b/core/src/components/alert/readme.md index 8e3ef538b8..ea1216fbeb 100644 --- a/core/src/components/alert/readme.md +++ b/core/src/components/alert/readme.md @@ -57,12 +57,12 @@ Alerts can also include several different inputs whose data can be passed back t ## Methods -| Method | Description | -| --------------- | --------------------------------------------------------------------------------------------------------------------------------- | -| `dismiss` | Dismiss the alert overlay after it has been presented. | -| `onDidDismiss` | Returns a promise that resolves when the alert did dismiss. It also accepts a callback that is called in the same circumstances. | -| `onWillDismiss` | Returns a promise that resolves when the alert will dismiss. It also accepts a callback that is called in the same circumstances. | -| `present` | Present the alert overlay after it has been created. | +| Method | Description | +| --------------- | ------------------------------------------------------------ | +| `dismiss` | Dismiss the alert overlay after it has been presented. | +| `onDidDismiss` | Returns a promise that resolves when the alert did dismiss. | +| `onWillDismiss` | Returns a promise that resolves when the alert will dismiss. | +| `present` | Present the alert overlay after it has been created. | ---------------------------------------------- diff --git a/core/src/components/loading/loading.tsx b/core/src/components/loading/loading.tsx index 4f61c8827a..5a66d80252 100644 --- a/core/src/components/loading/loading.tsx +++ b/core/src/components/loading/loading.tsx @@ -137,7 +137,7 @@ export class Loading implements OverlayInterface { @Listen('ionBackdropTap') protected onBackdropTap() { - return this.dismiss(null, BACKDROP); + return this.dismiss(undefined, BACKDROP); } /** @@ -167,8 +167,7 @@ export class Loading implements OverlayInterface { } /** - * Returns a promise that resolves when the loading did dismiss. It also accepts a callback - * that is called in the same circumstances. + * Returns a promise that resolves when the loading did dismiss. */ @Method() onDidDismiss(): Promise { @@ -176,8 +175,7 @@ export class Loading implements OverlayInterface { } /** - * Returns a promise that resolves when the loading will dismiss. It also accepts a callback - * that is called in the same circumstances. + * Returns a promise that resolves when the loading will dismiss. */ @Method() onWillDismiss(): Promise { diff --git a/core/src/components/loading/readme.md b/core/src/components/loading/readme.md index ad03af2a50..93f2abdd15 100644 --- a/core/src/components/loading/readme.md +++ b/core/src/components/loading/readme.md @@ -49,12 +49,12 @@ The loading indicator can be dismissed automatically after a specific amount of ## Methods -| Method | Description | -| --------------- | ----------------------------------------------------------------------------------------------------------------------------------- | -| `dismiss` | Dismiss the loading overlay after it has been presented. | -| `onDidDismiss` | Returns a promise that resolves when the loading did dismiss. It also accepts a callback that is called in the same circumstances. | -| `onWillDismiss` | Returns a promise that resolves when the loading will dismiss. It also accepts a callback that is called in the same circumstances. | -| `present` | Present the loading overlay after it has been created. | +| Method | Description | +| --------------- | -------------------------------------------------------------- | +| `dismiss` | Dismiss the loading overlay after it has been presented. | +| `onDidDismiss` | Returns a promise that resolves when the loading did dismiss. | +| `onWillDismiss` | Returns a promise that resolves when the loading will dismiss. | +| `present` | Present the loading overlay after it has been created. | ---------------------------------------------- diff --git a/core/src/components/modal/modal.tsx b/core/src/components/modal/modal.tsx index b2cfbf7664..b300dcffe3 100644 --- a/core/src/components/modal/modal.tsx +++ b/core/src/components/modal/modal.tsx @@ -132,7 +132,7 @@ export class Modal implements OverlayInterface { @Listen('ionBackdropTap') protected onBackdropTap() { - return this.dismiss(null, BACKDROP); + return this.dismiss(undefined, BACKDROP); } @Listen('ionModalDidPresent') @@ -186,8 +186,7 @@ export class Modal implements OverlayInterface { } /** - * Returns a promise that resolves when the modal did dismiss. It also accepts a callback - * that is called in the same circumstances. + * Returns a promise that resolves when the modal did dismiss. * */ @Method() @@ -196,8 +195,7 @@ export class Modal implements OverlayInterface { } /** - * Returns a promise that resolves when the modal will dismiss. It also accepts a callback - * that is called in the same circumstances. + * Returns a promise that resolves when the modal will dismiss. * */ @Method() diff --git a/core/src/components/modal/readme.md b/core/src/components/modal/readme.md index 03fcee16a5..7981001907 100644 --- a/core/src/components/modal/readme.md +++ b/core/src/components/modal/readme.md @@ -44,12 +44,12 @@ Modals can be created using a [Modal Controller](../../modal-controller/ModalCon ## Methods -| Method | Description | -| --------------- | --------------------------------------------------------------------------------------------------------------------------------- | -| `dismiss` | Dismiss the modal overlay after it has been presented. | -| `onDidDismiss` | Returns a promise that resolves when the modal did dismiss. It also accepts a callback that is called in the same circumstances. | -| `onWillDismiss` | Returns a promise that resolves when the modal will dismiss. It also accepts a callback that is called in the same circumstances. | -| `present` | Present the modal overlay after it has been created. | +| Method | Description | +| --------------- | ------------------------------------------------------------ | +| `dismiss` | Dismiss the modal overlay after it has been presented. | +| `onDidDismiss` | Returns a promise that resolves when the modal did dismiss. | +| `onWillDismiss` | Returns a promise that resolves when the modal will dismiss. | +| `present` | Present the modal overlay after it has been created. | ---------------------------------------------- diff --git a/core/src/components/picker/picker.tsx b/core/src/components/picker/picker.tsx index 16cc3c6c27..c611cba77e 100644 --- a/core/src/components/picker/picker.tsx +++ b/core/src/components/picker/picker.tsx @@ -170,9 +170,7 @@ export class Picker implements OverlayInterface { } /** - * Returns a promise that resolves when the picker did dismiss. It also accepts a callback - * that is called in the same circustances. - * + * Returns a promise that resolves when the picker did dismiss. */ @Method() onDidDismiss(): Promise { @@ -180,9 +178,7 @@ export class Picker implements OverlayInterface { } /** - * Returns a promise that resolves when the picker will dismiss. It also accepts a callback - * that is called in the same circumstances. - * + * Returns a promise that resolves when the picker will dismiss. */ @Method() onWillDismiss(): Promise { diff --git a/core/src/components/picker/readme.md b/core/src/components/picker/readme.md index ef57e8ad71..06e07fd572 100644 --- a/core/src/components/picker/readme.md +++ b/core/src/components/picker/readme.md @@ -39,13 +39,13 @@ A Picker is a dialog that displays a row of buttons and columns underneath. It a ## Methods -| Method | Description | -| --------------- | ---------------------------------------------------------------------------------------------------------------------------------- | -| `dismiss` | Dismiss the picker overlay after it has been presented. | -| `getColumn` | Returns the column the matches the specified name | -| `onDidDismiss` | Returns a promise that resolves when the picker did dismiss. It also accepts a callback that is called in the same circustances. | -| `onWillDismiss` | Returns a promise that resolves when the picker will dismiss. It also accepts a callback that is called in the same circumstances. | -| `present` | Present the picker overlay after it has been created. | +| Method | Description | +| --------------- | ------------------------------------------------------------- | +| `dismiss` | Dismiss the picker overlay after it has been presented. | +| `getColumn` | Returns the column the matches the specified name | +| `onDidDismiss` | Returns a promise that resolves when the picker did dismiss. | +| `onWillDismiss` | Returns a promise that resolves when the picker will dismiss. | +| `present` | Present the picker overlay after it has been created. | ---------------------------------------------- diff --git a/core/src/components/popover/popover.tsx b/core/src/components/popover/popover.tsx index 5cc56c1d39..f6da48731c 100644 --- a/core/src/components/popover/popover.tsx +++ b/core/src/components/popover/popover.tsx @@ -142,7 +142,7 @@ export class Popover implements OverlayInterface { @Listen('ionBackdropTap') protected onBackdropTap() { - return this.dismiss(null, BACKDROP); + return this.dismiss(undefined, BACKDROP); } @Listen('ionPopoverDidPresent') @@ -196,9 +196,7 @@ export class Popover implements OverlayInterface { } /** - * Returns a promise that resolves when the popover did dismiss. It also accepts a callback - * that is called in the same circustances. - * + * Returns a promise that resolves when the popover did dismiss. */ @Method() onDidDismiss(): Promise { @@ -206,9 +204,7 @@ export class Popover implements OverlayInterface { } /** - * Returns a promise that resolves when the popover will dismiss. It also accepts a callback - * that is called in the same circustances. - * + * Returns a promise that resolves when the popover will dismiss. */ @Method() onWillDismiss(): Promise { diff --git a/core/src/components/popover/readme.md b/core/src/components/popover/readme.md index b21311cd24..d27ebdacec 100644 --- a/core/src/components/popover/readme.md +++ b/core/src/components/popover/readme.md @@ -48,12 +48,12 @@ To present a popover, call the `present` method on a popover instance. In order ## Methods -| Method | Description | -| --------------- | ---------------------------------------------------------------------------------------------------------------------------------- | -| `dismiss` | Dismiss the popover overlay after it has been presented. | -| `onDidDismiss` | Returns a promise that resolves when the popover did dismiss. It also accepts a callback that is called in the same circustances. | -| `onWillDismiss` | Returns a promise that resolves when the popover will dismiss. It also accepts a callback that is called in the same circustances. | -| `present` | Present the popover overlay after it has been created. | +| Method | Description | +| --------------- | -------------------------------------------------------------- | +| `dismiss` | Dismiss the popover overlay after it has been presented. | +| `onDidDismiss` | Returns a promise that resolves when the popover did dismiss. | +| `onWillDismiss` | Returns a promise that resolves when the popover will dismiss. | +| `present` | Present the popover overlay after it has been created. | ---------------------------------------------- diff --git a/core/src/components/toast/readme.md b/core/src/components/toast/readme.md index 53f439a8c9..c128f09491 100644 --- a/core/src/components/toast/readme.md +++ b/core/src/components/toast/readme.md @@ -51,12 +51,12 @@ The toast can be dismissed automatically after a specific amount of time by pass ## Methods -| Method | Description | -| --------------- | -------------------------------------------------------------------------------------------------------------------------------- | -| `dismiss` | Dismiss the toast overlay after it has been presented. | -| `onDidDismiss` | Returns a promise that resolves when the toast did dismiss. It also accepts a callback that is called in the same circustances. | -| `onWillDismiss` | Returns a promise that resolves when the toast will dismiss. It also accepts a callback that is called in the same circustances. | -| `present` | Present the toast overlay after it has been created. | +| Method | Description | +| --------------- | ------------------------------------------------------------ | +| `dismiss` | Dismiss the toast overlay after it has been presented. | +| `onDidDismiss` | Returns a promise that resolves when the toast did dismiss. | +| `onWillDismiss` | Returns a promise that resolves when the toast will dismiss. | +| `present` | Present the toast overlay after it has been created. | ## CSS Custom Properties diff --git a/core/src/utils/overlays.ts b/core/src/utils/overlays.ts index 34dd5a8f90..029fd77b85 100644 --- a/core/src/utils/overlays.ts +++ b/core/src/utils/overlays.ts @@ -36,7 +36,7 @@ export function createOverlay(element: T, opts: function closeTopOverlay(doc: Document) { const lastOverlay = getOverlay(doc); if (lastOverlay && lastOverlay.backdropDismiss) { - return lastOverlay.dismiss(null, BACKDROP); + return lastOverlay.dismiss(undefined, BACKDROP); } return Promise.resolve(); }