|
|
|
|
MioFactory TechNotes
Help
JavaScriptLibraries
Products
|
|
If your application is displayed information downloaded from XML feeds, you may need to know if the user has read a news item or not.
The library xmlFeed.js provides functions to mark a news item as read or as unread, and to save the marks to disk.
The RSS feeds must be downloaded with xmlfeed_load in order to use read marks. If you are using the library channels.js or alertEngineEx.js, you can use read marks as the function xmlfeed_load is used to download the feeds.
Read Marks file| |
The file readMarks.mem, saved in the application folder, contains the list of unique IDs of the news items marked as read.
So when a news item is marked as read, it's ID is stored in the read marks file. Otherwise, the ID is not stored in the file.
By default, this list is limited to 5000 items. Set the variable MAX_READMARKS to change this limit.
You can clear all the read marks with xmlfeed_readMarks_clear.
|
How to use read marks| |
First of all, you must load the read marks file with the function xmlfeed_readMarks_load.
When loaded, the read marks are stored as a text string in the variable READMARKS_DATA.
Then, when the user read a news item, you should call the function xmlfeed_readMarks_setAsRead in order to mark the news item as read.
To mark an item as unread, call xmlfeed_readMarks_setAsUnread. The item ID will be removed from the read marks list.
Important: When you update the list of read marks, you must call xmlfeed_readMarks_save to save your changes to disk. If you do not call this function, the read marks are lost when the application is closed.
When you need to know if an item is read or not, you just have to evaluate the result of the function xmlfeed_readMarks_isRead or xmlfeed_readMarks_isUnread.
|
Using read marks with channels
|
|
|