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

Remove link to notification example #34412

Merged
merged 1 commit into from
Jun 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions files/en-us/web/api/notification/notification/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,11 @@ An instance of the {{domxref("Notification")}} object.

## Examples

In our
[`Emogotchi demo`](https://chrisdavidmills.github.io/emogotchi/)
([see source code](https://github.com/chrisdavidmills/emogotchi)), we run a
`spawnNotification()` function when we want to trigger a notification. The
function is passed parameters to specify the body, icon, and title we want, and then it
creates the necessary `options` object and triggers the notification by using
the `Notification()` constructor.
Here is a most basic example to only show a notification if permission is already granted. For more complete examples, see the {{domxref("Notification")}} page.

```js
function spawnNotification(body, icon, title) {
const notification = new Notification(title, { body, icon });
if (Notification.permission === "granted") {
const notification = new Notification("Hi there!");
}
```

Expand Down