Răsfoiți Sursa

really change method name

Natan Keddem 1 an în urmă
părinte
comite
b28c83c1fc

+ 1 - 1
nicegui/elements/json_editor.js

@@ -31,7 +31,7 @@ export default {
         this.editor.destroy();
         this.editor.destroy();
       }
       }
     },
     },
-    call_api_method(name, arg) {
+    run_api_method(name, arg) {
       if (this.editor) {
       if (this.editor) {
         if (arg === null) {
         if (arg === null) {
           return this.editor[name]();
           return this.editor[name]();

+ 3 - 3
nicegui/elements/json_editor.py

@@ -44,6 +44,6 @@ class JsonEditor(Element, component='json_editor.js', exposed_libraries=['lib/va
         super().update()
         super().update()
         self.run_method('update_editor')
         self.run_method('update_editor')
 
 
-    def call_api_method(self, name: str, arg: Optional[str] = None, timeout: float = 1,
-                        check_interval: float = 0.01) -> AwaitableResponse:
-        return self.run_method('call_api_method', name, arg, timeout=timeout, check_interval=check_interval)
+    def run_api_method(self, name: str, arg: Optional[str] = None, timeout: float = 1,
+                       check_interval: float = 0.01) -> AwaitableResponse:
+        return self.run_method('run_api_method', name, arg, timeout=timeout, check_interval=check_interval)

+ 3 - 3
website/documentation/content/json_editor_documentation.py

@@ -23,11 +23,11 @@ def main_demo() -> None:
     editor = ui.json_editor({'content': {'json': json}},
     editor = ui.json_editor({'content': {'json': json}},
                             on_select=lambda e: ui.notify(f'Select: {e}'),
                             on_select=lambda e: ui.notify(f'Select: {e}'),
                             on_change=lambda e: ui.notify(f'Change: {e}'))
                             on_change=lambda e: ui.notify(f'Change: {e}'))
-    ui.button('Expand All', on_click=lambda: editor.call_api_method('expand', 'path => true'))
-    ui.button('Collapse All', on_click=lambda: editor.call_api_method('expand', 'path => false'))
+    ui.button('Expand All', on_click=lambda: editor.run_api_method('expand', 'path => true'))
+    ui.button('Collapse All', on_click=lambda: editor.run_api_method('expand', 'path => false'))
 
 
     async def show_data() -> None:
     async def show_data() -> None:
-        data = await editor.call_api_method('get')
+        data = await editor.run_api_method('get')
         ui.notify(data)
         ui.notify(data)
     ui.button('Show Data', on_click=show_data)
     ui.button('Show Data', on_click=show_data)