MCPcopy Create free account
hub / github.com/pywebio/PyWebIO / EnvSettingHandler

Class EnvSettingHandler

webiojs/src/handlers/env.ts:5–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3import {config, state} from "../state";
4
5export class EnvSettingHandler implements CommandHandler {
6 accept_command: string[] = ['set_env'];
7
8 constructor() {
9 }
10
11 handle_message(msg: Command) {
12 let spec = msg.spec;
13 if (spec.title !== undefined) {
14 document.title = spec.title;
15 }
16
17 if (spec.auto_scroll_bottom !== undefined)
18 state.AutoScrollBottom = spec.auto_scroll_bottom;
19
20 if (spec.output_animation !== undefined) {
21 config.outputAnimation = spec.output_animation;
22 if(!spec.output_animation){
23 document.body.classList.add('no-animation');
24 }else{
25 document.body.classList.remove('no-animation');
26 }
27 }
28
29 if (spec.http_pull_interval !== undefined) {
30 if (state.CurrentSession instanceof HttpSession)
31 state.CurrentSession.change_pull_interval(spec.http_pull_interval);
32 }
33
34 if (spec.input_panel_min_height !== undefined) {
35 state.InputPanelMinHeight = spec.input_panel_min_height;
36 }
37
38 if (spec.input_panel_init_height !== undefined) {
39 state.InputPanelInitHeight = spec.input_panel_init_height;
40 }
41
42 if (spec.input_panel_fixed !== undefined) {
43 state.FixedInputPanel = spec.input_panel_fixed;
44 }
45
46 if (spec.input_auto_focus !== undefined) {
47 state.AutoFocusOnInput = spec.input_auto_focus;
48 }
49
50 if (spec.output_max_width !== undefined) {
51 $('#output-container').css('max-width', spec.output_max_width);
52 }
53 }
54}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…