Are there any advantages to balancing server load when processing events using JavaScript code compared to Vaadin code?

Let's say I want to handle a button event that does not execute any business logic, just updates the DOM:

Button button = new Button("Click Me");
button.addClickListener(evt -> button.setCaption("Clicked!"));

This makes the event round-trip and adds load to the server.

Now I can do the same with JavaScript (with jQuery):

Button button = new Button("Click Me");
button.setId("button");

JavaScript.getCurrent().execute(

              "$('#button').click(function(){"
            + "     $('#button').find('.v-button-caption').text('Clicked!');"
            + "})"
      );

Is it server side optimization?
Will the Vaadin client engine not send a request at all if listeners are not connected?

+4
source share
3 answers

Button ( "" ). - . , , ( ).

, , , (, GWT AbstractJavascriptComponent).

JQuery: ( ), - - . , , , " , , "

+4

, . UI .

192.x.x.x - - [03/Jan/2018: 09: 56: 20 +0200] "POST/vaadin-test/UIDL/? v-uiId = 0 HTTP/1.1" 200 157

, , . , Vaadin Button , .

+1

, . - -, , I/O - , ( ) . SSD-, , , , , .

Therefore, avoiding the network is an optimization method. Why do you think caching is so common in network applications?

0
source

Source: https://habr.com/ru/post/1691653/


All Articles