comparison core/modules/history/js/mark-as-read.es6.js @ 0:c75dbcec494b

Initial commit from drush-created site
author Chris Cannam
date Thu, 05 Jul 2018 14:24:15 +0000
parents
children a9cd425dd02b
comparison
equal deleted inserted replaced
-1:000000000000 0:c75dbcec494b
1 /**
2 * @file
3 * Marks the nodes listed in drupalSettings.history.nodesToMarkAsRead as read.
4 *
5 * Uses the History module JavaScript API.
6 *
7 * @see Drupal.history
8 */
9
10 (function (window, Drupal, drupalSettings) {
11 // When the window's "load" event is triggered, mark all enumerated nodes as
12 // read. This still allows for Drupal behaviors (which are triggered on the
13 // "DOMContentReady" event) to add "new" and "updated" indicators.
14 window.addEventListener('load', () => {
15 if (drupalSettings.history && drupalSettings.history.nodesToMarkAsRead) {
16 Object.keys(drupalSettings.history.nodesToMarkAsRead).forEach(Drupal.history.markAsRead);
17 }
18 });
19 }(window, Drupal, drupalSettings));