Notifications component
Weavy automatically creates notifications for reactions, mentions and other activities. With the Notifications component you can display these notifications, mark them as read/unread, and handle navigation when a notification is clicked.
Element: <wy-notifications>
Class: WyNotifications
Note that the notifications block is not very useful in itself, but works in collaboration with other components where the actual notifications are generated.
Usage
First import and configure Weavy
and the WyNotifications
component.
import { Weavy, WyNotifications } from "@weavy/uikit-web";
const weavy = new Weavy();
weavy.url = "https://myenvironment.weavy.io";
weavy.tokenFactory = async (refresh) => "token_from_server";
Then add the <wy-notifications>
component to your HTML.
<wy-notifications></wy-notifications>
Properties
Property | Type | Description |
---|---|---|
uid? |
string |
Optional filter to only show notifications for app with uid . |
Example: Display notifications for app with specified uid
.
<wy-notifications uid="test-chat"></wy-notifications>
Methods
Method | Returns | Description |
---|---|---|
markAllAsRead() |
Marks all notifications as read. Respects any filtering set by the uid property. |
Events
Clicking a notification in the notifications component emits a wy:link
event that you can handle to navigate to the correct page or view in your application.