Giter Site home page Giter Site logo

use-browser-notifications's Introduction

image

@astre9/use-browser-notifications

React friendly utility hook to trigger browser notifications.

Installation

pnpm

pnpm add @astre9/use-browser-notifications

yarn

yarn add @astre9/use-browser-notifications

npm

npm i @astre9/use-browser-notifications

Usage

Make sure your notification settings are ON! But if they aren't, expect Dwight to show up at your desk with a disappointed look.

Windows Users: Navigate to the dark realms of Settings > System > Notifications. Don't get lost!

macOS Fans: Seek out the elusive System Preferences > Notifications. You might find a hidden Dundie!

After setting up, here's a sneak peek of how to make the magic happen:

import useNotification from "use-browser-notifications";

const App = () => {
	const trigerNotification = useNotification("Dundie Award Nominations", {
		body: "Nominate your colleagues for various Dundie Awards categories. Let's celebrate our exceptional team members!",
	});

	return (
		<main className="App">
			<button onClick={trigerNotification}>Hello</button>
		</main>
	);
};

Arguments

Argument Type Description Required
title string This is a string that represents the title or heading of the notification. yes
options NotificationOptions Notification options are configuration settings that customize the appearance and behavior of a notification, such as its body, icon, and sound. no

P.S.: This library only works if you turn on the notification settings. We don't want to be like Toby, always ignored!

If you need some help, please write email to me: [email protected]

use-browser-notifications's People

Contributors

alex-streza avatar github-actions[bot] avatar

Stargazers

André "Dezzy" Victor avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.