diff --git a/README.rst b/README.rst index 1852bb25..2ded77c9 100644 --- a/README.rst +++ b/README.rst @@ -120,9 +120,10 @@ and are prefixed with `on_*`. * **on_server_ready** : All protocols initialized and available for client to connect * **on_client_connected** : Connection established to server * **on_client_exited** : Linked to browser "beforeunload" event +* **on_server_start** : Trame is starting its event loop * **on_server_exited** : Trame is exiting its event loop - * **on_server_reload** : If callback registered it is used for reloading server side modules +* **on_error** : A JavaScript error has occurred in the client, can be used to do something on the server when this occurs Reserved state entries diff --git a/examples/validation/decorators/default_class_decorator.py b/examples/validation/decorators/default_class_decorator.py index a396fe33..8af9688a 100644 --- a/examples/validation/decorators/default_class_decorator.py +++ b/examples/validation/decorators/default_class_decorator.py @@ -34,6 +34,10 @@ def one_slider(self, slider_value1, **kwargs): def on_ready(self, *args, **kwargs): print("on_ready") + @life_cycle.on_error + def on_error(self, message): + print(f"A JS error occured: {message}") + def ui(self): with SinglePageLayout(self.server) as layout: with layout.toolbar: @@ -47,6 +51,7 @@ def ui(self): vuetify.VBtn("trigger", click="trigger('exec')") vuetify.VBtn("method", click=self.method_call) vuetify.VBtn("ctrl", click=self.ctrl.hello) + vuetify.VBtn("JS error", click="undefined_func()") app = App()