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

[WIP] feature: Notifications API #1560

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions SERVERPLUGINS.md
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,49 @@ app.registerDeltaInputHandler((delta, next) => {
})
```

### `app.notify(path, value, pluginId)`

Notifications API interface method for raising, updating and clearing notifications.

- `path`: Signal K path of the notification

- `value`: A valid `Notification` object or `null` if clearing a notification.

- `pluginId` The plugin identifier.


To raise or update a for a specified path, call the method with a valid `Notification` object as the `value`.

- returns: `string` value containing the `id` of the new / updated notification.

_Example:_
```javascript
const alarmId = app.notify(
'myalarm',
{
message: 'My cutom alarm text',
state: 'alert'
},
'myAlarmPlugin'
)

// alarmId = "ac3a3b2d-07e8-4f25-92bc-98e7c92f7f1a"
```

To clear (cancel) a notification call the method with `null` as the `value`.

- returns: `void`.

_Example: Clear notification_
```javascript
const alarmId = app.notify(
'myalarm',
null,
'myAlarmPlugin'
)
```


### `app.registerResourceProvider(resourceProvider)`

See [`RESOURCE_PROVIDER_PLUGINS`](./RESOURCE_PROVIDER_PLUGINS.md) for details.
Expand Down
Loading
Loading