annotate core/modules/history/js/mark-as-read.es6.js @ 5:12f9dff5fda9 tip

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:34:47 +0100
parents a9cd425dd02b
children
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@4 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@4 16 Object.keys(drupalSettings.history.nodesToMarkAsRead).forEach(
Chris@4 17 Drupal.history.markAsRead,
Chris@4 18 );
Chris@0 19 }
Chris@0 20 });
Chris@4 21 })(window, Drupal, drupalSettings);