mirror of https://github.com/zulip/zulip.git
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:
parent
dfdbc378b0
commit
190524b6a0
|
@ -3,6 +3,9 @@ var alert_words = (function () {
|
||||||
var exports = {};
|
var exports = {};
|
||||||
|
|
||||||
exports.words = page_params.alert_words;
|
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 the `page_params.alert_words` since we are its sole user.
|
||||||
delete page_params.alert_words;
|
delete page_params.alert_words;
|
||||||
|
|
|
@ -6,7 +6,7 @@ exports.dispatch_normal_event = function dispatch_normal_event(event) {
|
||||||
var noop = function () {};
|
var noop = function () {};
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case 'alert_words':
|
case 'alert_words':
|
||||||
alert_words.words = event.alert_words;
|
alert_words.set_words(event.alert_words);
|
||||||
alert_words_ui.render_alert_words_ui();
|
alert_words_ui.render_alert_words_ui();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue