mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 21:13:36 +00:00
docs: Update feature tutorial for server_events_dispatch.js.
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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':
|
||||
|
||||
Reference in New Issue
Block a user