From 190524b6a0107730e00c577ac60814cb22ca034a Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Sat, 4 Aug 2018 02:25:43 -0400 Subject: [PATCH] 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 --- static/js/alert_words.js | 3 +++ static/js/server_events_dispatch.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/static/js/alert_words.js b/static/js/alert_words.js index e5a9045f90..4b135828ad 100644 --- a/static/js/alert_words.js +++ b/static/js/alert_words.js @@ -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; diff --git a/static/js/server_events_dispatch.js b/static/js/server_events_dispatch.js index a3fa46202d..4b780fbf53 100644 --- a/static/js/server_events_dispatch.js +++ b/static/js/server_events_dispatch.js @@ -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;