alert_words.js: Add setter for words.

After migration to an ES6 module, `words` would no longer be mutable
from outside the module.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
Anders Kaseorg 2018-08-04 02:25:43 -04:00 committed by Tim Abbott
parent dfdbc378b0
commit 190524b6a0
2 changed files with 4 additions and 1 deletions

View File

@ -3,6 +3,9 @@ var alert_words = (function () {
var exports = {};
exports.words = page_params.alert_words;
exports.set_words = function (value) {
exports.words = value;
};
// Delete the `page_params.alert_words` since we are its sole user.
delete page_params.alert_words;

View File

@ -6,7 +6,7 @@ exports.dispatch_normal_event = function dispatch_normal_event(event) {
var noop = function () {};
switch (event.type) {
case 'alert_words':
alert_words.words = event.alert_words;
alert_words.set_words(event.alert_words);
alert_words_ui.render_alert_words_ui();
break;