konsoletyper / teavm

Compiles Java bytecode to JavaScript, WebAssembly and C
https://teavm.org
Apache License 2.0
2.62k stars 261 forks source link

Input event #902

Closed Ihromant closed 1 month ago

Ihromant commented 1 month ago

Hi @konsoletyper is something wrong with this PR that you're ignoring it?

konsoletyper commented 1 month ago

I see no purpose for this. How the introduced interfaces can be used in a practical (not toy example) case?

Ihromant commented 1 month ago

I added intermediate UIEvent because it is real intermediate JS interface between generic Event and specific events. Main purpose of this PR is to add InputEvent which I am using. Adding UIEvent can be avoided, but in this case getDetail should be added everywhere.

konsoletyper commented 1 month ago

You should at least add corresponding EventTarget interface. And I still have no idea how exactly you are going to use it in any real-world scenario, at least in this form. Do you just detect the fact of a change in document, or you really check inputType property as well as data to extract something useful? In former case I still don't understand why you need a separate event. In the latter case how exactly you interpret inputType?

Ihromant commented 1 month ago

I have large text area and checking what user is doing with its content before submitting. For this reason I need inputType (together with data) to track changes in this text area. I didn't find other way to achieve this without InputEvent.

Don't get the remark about eventTarget. It is inherited from Event interface, isn't it?

konsoletyper commented 1 month ago

I have large text area and checking what user is doing with its content before submitting.

So you basically ignore inputType and data properties, right?

Don't get the remark about eventTarget. It is inherited from Event interface, isn't it?

Please, see how other events are implemented. For example, recent TouchEvent

Ihromant commented 1 month ago

So you basically ignore inputType and data properties, right? No, I'm using them. Please, see how other events are implemented. For example, recent TouchEvent Done.

konsoletyper commented 1 month ago

So you basically ignore inputType and data properties, right?

No, I'm using them.

How?

Ihromant commented 1 month ago

How?

For instance, I'm reacting differently on paste than on regular key input.

konsoletyper commented 1 month ago

And please remove UIEvent. While other properties might be useful, your implementation does not provide them. As for detail, it's ugly designed in the standard and can be actually moved to MouseEvent, if you really need it.