diff --git a/docs/new-feature-tutorial.md b/docs/new-feature-tutorial.md index a11e392413..d7fdcad71f 100644 --- a/docs/new-feature-tutorial.md +++ b/docs/new-feature-tutorial.md @@ -60,7 +60,7 @@ Realm setting, in `test_realm.py`). **JavaScript:** Zulip's JavaScript is located in the directory `static/js/`. The exact files you may need to change depend on your feature. If you've added a new event that is sent to clients, be sure to -add a handler for it to `static/js/server_events.js`. +add a handler for it to `static/js/server_events_dispatch.js`. **CSS:** The primary CSS file is `static/styles/zulip.css`. If your new feature requires UI changes, you may need to add additional CSS to this @@ -395,10 +395,10 @@ form control in `static/js/admin.js`. } }); -Finally, update `server_events.js` to handle related events coming from +Finally, update `server_events_dispatch.js` to handle related events coming from the server. - # static/js/server_events.js + # static/js/server_events_dispatch.js function dispatch_normal_event(event) { switch (event.type) { diff --git a/static/js/server_events.js b/static/js/server_events.js index af3d2cedb2..d63d3d266e 100644 --- a/static/js/server_events.js +++ b/static/js/server_events.js @@ -59,6 +59,10 @@ function get_events_success(events) { events_stored_while_loading = []; } + // Most events are dispatched via the code server_events_dispatch, + // called in the default case. The goal of this split is to avoid + // contributors needing to read or understand the complex and + // rarely modified logic for non-normal events. var dispatch_event = function dispatch_event(event) { switch (event.type) { case 'message':