(object: any, js_func_key: string)
| 150 | } |
| 151 | |
| 152 | function parse_js_func(object: any, js_func_key: string) { |
| 153 | return JSON.parse(JSON.stringify(object), (key, value) => { |
| 154 | if ( |
| 155 | typeof value === 'object' && |
| 156 | value.__pywebio_js_function__ === js_func_key && |
| 157 | 'params' in value && 'body' in value |
| 158 | ) { |
| 159 | try { |
| 160 | return new Function(...value.params, value.body); |
| 161 | } catch (e) { |
| 162 | console.error("Parse js function error: %s", e); |
| 163 | return null; |
| 164 | } |
| 165 | } |
| 166 | return value; |
| 167 | }) |
| 168 | } |
| 169 | |
| 170 | function safe_run(func_name: string, func: any, ...args: any[]) { |
| 171 | try { |
no outgoing calls
no test coverage detected
searching dependent graphs…