0.0.4 • Published 4 years ago

use-notification-hook v0.0.4

Weekly downloads
4
License
Unlicense
Repository
github
Last release
4 years ago

⚛️ useNotification hook

useNotification is a React Hook API abstraction for native browser Notification API.

Usage

import useNotification from 'use-notification-hook';

const Demo = () => {
  const { notify, close } = useNotification('Notification title', {
    body: 'Notification body',
    onClose: (e) => {
      console.log(e);
    },
  });

  return (
    <div>
      <button onClick={notify}>Show notification</button>
      <button onClick={close}>Close notification</button>
    </div>
  );
};

Handlers

  • notify - show notification
  • close - close latest instance of notification

Options

For a list of options and event handler please see this link

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago