From eb372d27743459de836ac2317bd97073020ac4ec Mon Sep 17 00:00:00 2001 From: stasson Date: Wed, 10 Jan 2018 17:51:39 +0100 Subject: [PATCH] feat(snackbar): add show and hide event as per mdc 0.28.0 --- components/snackbar/README.md | 5 ++++- components/snackbar/mdc-snackbar.vue | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/components/snackbar/README.md b/components/snackbar/README.md index 83b08bb3..671c4c7a 100644 --- a/components/snackbar/README.md +++ b/components/snackbar/README.md @@ -60,13 +60,16 @@ properties and their usage. | `dismisses-on-action` |Boolean| true| Whether the snackbar will be dimissed when the user presses the action button. | | `align-start` |Boolean| false| Whether the snackbar is start aligned. | - ### methods | method | Description | |--------|-------------| | `show(data)` | trigger the display of a message with optional action.| +# events +| `@show` | notify listeners that the snackbar has been shown. | +| `@hide` | notify listeners that the snackbar has been hidden. | + ### Reference - diff --git a/components/snackbar/mdc-snackbar.vue b/components/snackbar/mdc-snackbar.vue index 26d5b96d..17c92342 100644 --- a/components/snackbar/mdc-snackbar.vue +++ b/components/snackbar/mdc-snackbar.vue @@ -73,7 +73,9 @@ export default { }, deregisterTransitionEndHandler: (handler) => { this.$refs.root.removeEventListener(getCorrectEventName(window, 'transitionend'), handler) - } + }, + notifyShow: () => this.$emit('show'), + notifyHide: () => this.$emit('hide'), }) this.foundation.init() if (this.event) {