Mercurial > hg > isophonics-drupal-site
annotate core/modules/history/js/mark-as-read.es6.js @ 16:c2387f117808
Routine composer update
author | Chris Cannam |
---|---|
date | Tue, 10 Jul 2018 15:07:59 +0100 |
parents | 4c8ae668cc8c |
children | 129ea1e6d783 |
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)); |