Content - Routes / Pins / Announcement
Announcement
The Announcement API allows you to retrieve available news, display news as announcements or tooltips, and listen for events when users view or read news.
getAvailableNews :method
This method asynchronously returns a list of all news items available for the application.
Method Signature
getAvailableNews(configuration)Arguments
The configuration object supports the following property:
| Property | Type | Description | Required |
|---|---|---|---|
filterByTargetAudience | boolean | Determines whether the currently configured custom labels are used to filter the available news. If this property is not provided, no target audience filtering is applied. | No |
Code Sample
var configuration = {filterByTargetAudience:true};
window.appnaviApi.news.getAvailableNews(configuration).then(function(resp){
console.log("Available news are", resp);
});showAnnouncement :method
This method displays one or more news items as announcements.
The currently published version of each news item is displayed. If a news item has already been marked as read, it is not displayed again unless force is set to true.
You can display a single news item or multiple news items by providing their IDs in an array.
Method Signature
showAnnouncement(configuration)Arguments
The configuration object supports the following properties:
| Property | Type | Description | Required |
|---|---|---|---|
newsId | Array | Contains the IDs of the news items to display as announcements. | Yes |
force | boolean | Determines whether a news item is displayed even if it has already been marked as read. The default value is false. | No |
Code Sample
var configuration = {
newsId:["e7c515f9","f776a70c","c26b05fd"],
force: true
};
window.appnaviApi.news.showAnnouncement(configuration);
console.log("Announcement has been shown having id " + configuration.newsId);showInfo :method
This method displays an info-type news item as a tooltip.
The currently published version of the selected info item is displayed.
Method Signature
showInfo(configuration)Arguments
The configuration object supports the following properties:
| Property | Type | Description | Required |
|---|---|---|---|
infoId | string | The ID of the info item to display as a tooltip. | Yes |
filterByTargetAudience | boolean | Determines whether the currently configured custom labels are used to filter the info item. If this property is not provided, no target audience filtering is applied. | No |
Code Sample
var configuration = {
infoId:"cc9993ac",
filterByTargetAudience: true
};
window.appnaviApi.news.showInfo(configuration);
console.log("Info has been shown having id " + configuration.infoId);newsShow :event
This event is triggered when a news item is displayed in the News area.
This event is not triggered when the news item is displayed as an announcement.
Arguments
| Parameter | Type | Description |
|---|---|---|
newsId | string | The ID of the news item that was displayed. |
Code Sample
appnavi.event.register("an-newsShow", function(event){
var eventDetails = event.detail;
var detail = eventDetails.detail;
console.log("News displayed with ID", detail.newsId);
});newsRead :event
This event is triggered when a user marks a news item as read.
It applies to news items displayed both in the News area and in an Announcement window.
Arguments
| Parameter | Type | Description |
|---|---|---|
newsId | string | The ID of the news item that was marked as read. |
Code Sample
appnavi.event.register("an-newsRead", function(event){
var eventDetails = event.detail;
var detail = eventDetails.detail;
console.log("News read with ID", detail.newsId);
});announcementShow :event
This event is triggered when an Announcement window is displayed.
The event contains the IDs of all news items displayed in the Announcement window.
Arguments
| Parameter | Type | Description |
|---|---|---|
newsIds | array of strings | Contains the IDs of the news items displayed in the Announcement window. |
Code Sample
appnavi.event.register("an-announcementShow", function(event){
var eventDetails = event.detail;
var detail = eventDetails.detail;
console.log("The IDs of the news items displayed are", detail.newsIds);
});Quick Reference
| Method / Event | Purpose |
|---|---|
getAvailableNews | Retrieves available news items for the application. |
showAnnouncement | Displays one or more news items as announcements. |
showInfo | Displays an info item as a tooltip. |
newsShow | Triggered when a news item is displayed in the News area. |
newsRead | Triggered when a news item is marked as read. |
announcementShow | Triggered when an Announcement window is displayed. |
Updated about 1 hour ago