Why the framework add the mouseWheel event listener while I didn't need?

Hi all,

I only use custom controls in my web app. These controls have a single event (click). I just checked my page and all my controls: there are no other reported events.

Yet, if I run my web app on a mobile Android a little slow, I have warnings of this type that appear in my console:

  1. Actually, in the Chrome developer tools, I see that framework.js has added many events: mousewheel, mousedown, etc. Why the framework add the “mousewheel” event listener (on Window/document with the trackMouseWheel method) while I don’t need?

  2. Would it be possible to add the new “passive” property to mousewhell, touchstart, touchmove (…) events?

olivier

I would bet it’s part of the core Xojo framework javascript. I don’t know how intelligently they build the framework javascript that gets bundled with the app; but I have a feeling mouse events are just part of the main core that always gets added.

Create a feedback case, it’s the only way for that to happen.

They are necessary for the app to be able to add event handlers, they are all sent back to the app.

Don’t confuse a simple HTML page where you pick exactly the events you need, and a whole app where you may have hundreds of event handlers.

Of course, the js framework contains methods managing events. This not means that it will add all the event listeners on all controls on the page. Besides, it does not. For controls, the framework adds the event listener only if you open the corresponding handler event in Xojo.

But the framework adds many event listeners on the page itself, this time without adding the corresponding event handler to the page in our Xojo code. I guess some are necessary (“resize” for example). But keydown, keypress, keyup, focus, blur, mousedown, mouseup, mousemove, mousewheel…?

Of course, some do not consume much. But let’s not forget that we are working in a single thread with javascript, and many other listeners can be added through all other controls and libraries that we add. + event captures. + use on low-speed mobiles.

If these event listeners are needed, ok. But I wonder if it can be improved. MouseWheel (and probably mousemove) seems expensive according to Chrome. Xojo could ask the framework to add these events listeners only if it has detected that it needs?

I wonder about the complexity of adding only events that have a handler. It may not be trivial.

Why not file a feature request ?

[quote=315027:@Michel Bujardet]I wonder about the complexity of adding only events that have a handler. It may not be trivial.

Why not file a feature request ?[/quote]
We already do this for Controls. WebPages are a little more complicated as we use those in the framework for maintaining properties that users expect to have all the time.