Difference between revisions of "Notification.new"
From GiderosMobile
m (Text replacement - "</source>" to "</syntaxhighlight>") |
|||
| Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
| − | + | '''Available since:''' Gideros 2011.6<br/> | |
| − | ''' | + | '''Class:''' [[Notification]]<br/> |
| − | ''' | + | |
| − | === | + | === Description === |
| − | + | Creates new notification object with provided id. Scheduled notifications can later be canceled or modified using provided ID. | |
| + | <syntaxhighlight lang="lua"> | ||
| + | Notification.new(id) | ||
| + | </syntaxhighlight> | ||
Here are couple of scenarios that may happen, when creating notifications: | Here are couple of scenarios that may happen, when creating notifications: | ||
| + | * Notification with provided ID does not exist yet, so you simply create new scheduled notification | ||
| + | * if you create another notification with same ID, while the first one is till scheduled, you will simply modify the existing scheduled notification with new title, message, etc and can even change it's scheduled time by redispatching it | ||
| + | * if you create notification with same ID, while the first notification was already displayed, you will simply create a new notification | ||
| + | |||
| + | So as you see, you may use notification ID's as types of notifications. For example, if you have an energy bar that will be restored after some time, you could always dispatch this notification with same ID. | ||
| − | + | However, if you want to display for example, that there are new chat messages from different users, they should have different IDs. | |
| − | |||
| − | |||
| + | === Parameters === | ||
| + | '''id''': (number) the notification id<br/> | ||
| − | |||
| − | + | '''[[Notification]]''' | |
| − | |||
| − | |||
| − | |||
Latest revision as of 01:59, 16 November 2025
Available since: Gideros 2011.6
Class: Notification
Description
Creates new notification object with provided id. Scheduled notifications can later be canceled or modified using provided ID.
Notification.new(id)
Here are couple of scenarios that may happen, when creating notifications:
- Notification with provided ID does not exist yet, so you simply create new scheduled notification
- if you create another notification with same ID, while the first one is till scheduled, you will simply modify the existing scheduled notification with new title, message, etc and can even change it's scheduled time by redispatching it
- if you create notification with same ID, while the first notification was already displayed, you will simply create a new notification
So as you see, you may use notification ID's as types of notifications. For example, if you have an energy bar that will be restored after some time, you could always dispatch this notification with same ID.
However, if you want to display for example, that there are new chat messages from different users, they should have different IDs.
Parameters
id: (number) the notification id