annotate 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 |
rev |
line source |
Chris@0
|
1 /**
|
Chris@0
|
2 * @file
|
Chris@0
|
3 * Marks the nodes listed in drupalSettings.history.nodesToMarkAsRead as read.
|
Chris@0
|
4 *
|
Chris@0
|
5 * Uses the History module JavaScript API.
|
Chris@0
|
6 *
|
Chris@0
|
7 * @see Drupal.history
|
Chris@0
|
8 */
|
Chris@0
|
9
|
Chris@0
|
10 (function (window, Drupal, drupalSettings) {
|
Chris@0
|
11 // When the window's "load" event is triggered, mark all enumerated nodes as
|
Chris@0
|
12 // read. This still allows for Drupal behaviors (which are triggered on the
|
Chris@0
|
13 // "DOMContentReady" event) to add "new" and "updated" indicators.
|
Chris@0
|
14 window.addEventListener('load', () => {
|
Chris@0
|
15 if (drupalSettings.history && drupalSettings.history.nodesToMarkAsRead) {
|
Chris@0
|
16 Object.keys(drupalSettings.history.nodesToMarkAsRead).forEach(Drupal.history.markAsRead);
|
Chris@0
|
17 }
|
Chris@0
|
18 });
|
Chris@0
|
19 }(window, Drupal, drupalSettings));
|