Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add useNotification #177

Merged
merged 3 commits into from
May 8, 2020
Merged

feat: add useNotification #177

merged 3 commits into from
May 8, 2020

Conversation

Tarektouati
Copy link
Owner

@Tarektouati Tarektouati commented May 8, 2020

This implements a useNotification hook to mirror the Notification API

<template>
	<div>
		<button @click="showNotifcation">Toggle notification</button>
	</div>
</template>
<script>
import { useNotification } from 'vue-use-web';
import vueLogo from './logo.png'
export default {
	setup() {
		const { showNotifcation } = useNotification(
			'notification title',
			{
				icon: vueLogo,
				body: 'body of the notification',
			},
			{
				onClick: () => alert('Notification clicked'),
				onClose: () => alert('Notification closed'),
			}
		);
		return { showNotifcation };
	},
};
</script>

@Tarektouati Tarektouati force-pushed the feat/use-notification branch from dec7daf to d435c2b Compare May 8, 2020 12:26
@Tarektouati Tarektouati marked this pull request as ready for review May 8, 2020 12:45
@Tarektouati Tarektouati merged commit 1c3be8b into master May 8, 2020
@Tarektouati Tarektouati deleted the feat/use-notification branch May 8, 2020 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant