Notification
NodeBB provider module Notification class
Author: Accalia
License: MIT
- Notification
- static
- .bindNotification(forum) ⇒
Notification
- .bindNotification(forum) ⇒
- inner
- ~Notification
- new Notification(payload)
- instance
- .id :
string
- .postId :
number
- .topicId :
number
- .userId :
number
- .type :
notificationType
- .subtype :
string
- .read :
boolean
- .date :
Date
- .label :
string
- .body :
string
- .getText() ⇒
Promise.<string>
- .url() ⇒
Promise.<string>
- .getPost() ⇒
Promise.<Post>
- .getTopic() ⇒
Promise.<Topic>
- .getUser() ⇒
Promise.<User>
- .id :
- static
- .get(notificationId) ⇒
Promise.<Notification>
- .parse(payload) ⇒
Notification
- .getNotifications(eachNotification) ⇒
Promise
- .activate()
- .deactivate()
- .get(notificationId) ⇒
- ~Notification
- static
Notification.bindNotification(forum) ⇒ Notification
Create a Notification class and bind it to a forum instance
Kind: static method of Notification
Returns: Notification
- A Notification class bound to the provided forum
instance
Param | Type | Description |
---|---|---|
forum | Provider |
A forum instance to bind to constructed Notification class |
bindNotification~notificationType
Notification types enum
Kind: inner constant of bindNotification
Read only: true
Properties
Name | Default |
---|---|
notification | notification |
reply | reply |
mention | mention |
Notification~Notification
Notification Class
Represents a forum notification
Kind: inner class of Notification
Access: public
- ~Notification
- new Notification(payload)
- instance
- .id :
string
- .postId :
number
- .topicId :
number
- .userId :
number
- .type :
notificationType
- .subtype :
string
- .read :
boolean
- .date :
Date
- .label :
string
- .body :
string
- .getText() ⇒
Promise.<string>
- .url() ⇒
Promise.<string>
- .getPost() ⇒
Promise.<Post>
- .getTopic() ⇒
Promise.<Topic>
- .getUser() ⇒
Promise.<User>
- .id :
- static
- .get(notificationId) ⇒
Promise.<Notification>
- .parse(payload) ⇒
Notification
- .getNotifications(eachNotification) ⇒
Promise
- .activate()
- .deactivate()
- .get(notificationId) ⇒
new Notification(payload)
Construct a Notification object from payload
This constructor is intended to be private use only, if you need to construct a notification from payload
data use Notification.parse()
instead
Param | Type | Description |
---|---|---|
payload | * |
Payload to construct the Notification object out of |
notification.id : string
Unique notification id of this notification
Kind: instance property of Notification
Access: public
notification.postId : number
Post id this notification refers to
Kind: instance property of Notification
Access: public
notification.topicId : number
Topic id this post refers to
Kind: instance property of Notification
Access: public
notification.userId : number
User id that generated this notification
Kind: instance property of Notification
Access: public
notification.type : notificationType
Notification type code
Kind: instance property of Notification
Access: public
notification.subtype : string
Notification subtype
Kind: instance property of Notification
Access: public
notification.read : boolean
Is this notification read yet?
Kind: instance property of Notification
Access: public
notification.date : Date
Datetime this notification was generated on
Kind: instance property of Notification
Access: public
notification.label : string
Notification label
Kind: instance property of Notification
Access: public
notification.body : string
Content of notification.
Kind: instance property of Notification
Access: public
notification.getText() ⇒ Promise.<string>
HTML Markup for this notification body
Kind: instance method of Notification
Returns: Promise.<string>
- Resolves to the notification markup
Access: public
Promise:
Fulfill: the Notification markup
notification.url() ⇒ Promise.<string>
URL Link for the notification if available
Kind: instance method of Notification
Returns: Promise.<string>
- Resolves to the URL for the post the notification is for
Access: public
Promise:
Fullfil: string
The URL for the post the notification is for
notification.getPost() ⇒ Promise.<Post>
Get the post this Notification refers to
Kind: instance method of Notification
Returns: Promise.<Post>
- Resolves to the post the notification refers to
Access: public
Promise:
Fulfill: Post
the Post the notification refers to
notification.getTopic() ⇒ Promise.<Topic>
Get the topic this Notification refers to
Kind: instance method of Notification
Returns: Promise.<Topic>
- Resolves to the topic the notification refers to
Access: public
Promise:
Fulfill: Topic
the Topic the notification refers to
notification.getUser() ⇒ Promise.<User>
Get the user who generated this Notification
Kind: instance method of Notification
Returns: Promise.<User>
- Resolves to the user who generated this notification
Access: public
Promise:
Fulfill: Post
the User who generated this notification
Notification.get(notificationId) ⇒ Promise.<Notification>
Get a notification
Kind: static method of Notification
Returns: Promise.<Notification>
- resolves to the retrieved notification
Access: public
Promise:
Fulfill: Notification
the retrieved notification
Param | Type | Description |
---|---|---|
notificationId | string |
The id of the notification to get |
Notification.parse(payload) ⇒ Notification
Parse a notification from a given payload
Kind: static method of Notification
Returns: Notification
- the parsed notification
Access: public
Param | Type | Description |
---|---|---|
payload | * |
The notification payload |
Notification.getNotifications(eachNotification) ⇒ Promise
Get all notifications
Kind: static method of Notification
Returns: Promise
- Fulfills after notifications are processed
Access: public
Param | Type | Description |
---|---|---|
eachNotification | NotificationProcessor |
Function to process notifications |
Notification.activate()
Activate notifications.
Listen for new notifications and process ones that arrive
Kind: static method of Notification
Notification.deactivate()
Deactivate notifications
Stop listening for new notifcations.
Kind: static method of Notification