jso: add InputEvent (#902)

This commit is contained in:
Ivan Hetman 2024-08-14 15:48:21 +03:00 committed by GitHub
parent 8c15885f44
commit 2805631025
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 54 additions and 1 deletions

View File

@ -0,0 +1,26 @@
/*
* Copyright 2024 ihromant.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.teavm.jso.dom.events;
import org.teavm.jso.JSProperty;
public interface InputEvent extends Event {
@JSProperty
String getData();
@JSProperty
String getInputType();
}

View File

@ -0,0 +1,22 @@
/*
* Copyright 2024 ihromant.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.teavm.jso.dom.events;
public interface InputEventTarget extends EventTarget {
default Registration onInput(EventListener<InputEvent> listener) {
return onEvent("input", listener);
}
}

View File

@ -80,6 +80,9 @@ public interface MouseEvent extends Event {
@JSProperty
double getMovementY();
@JSProperty
int getDetail();
void initMouseEvent(String type, boolean canBubble, boolean cancelable, JSObject view, int detail, int screenX,
int screenY, int clientX, int clientY, boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey,
short button, EventTarget relatedTarget);

View File

@ -20,6 +20,7 @@ import org.teavm.jso.JSProperty;
import org.teavm.jso.dom.css.ElementCSSInlineStyle;
import org.teavm.jso.dom.events.EventTarget;
import org.teavm.jso.dom.events.FocusEventTarget;
import org.teavm.jso.dom.events.InputEventTarget;
import org.teavm.jso.dom.events.KeyboardEventTarget;
import org.teavm.jso.dom.events.LoadEventTarget;
import org.teavm.jso.dom.events.MouseEventTarget;
@ -32,7 +33,8 @@ import org.teavm.jso.dom.xml.NodeList;
import org.teavm.jso.popover.ToggleEventTarget;
public abstract class HTMLElement implements Element, ElementCSSInlineStyle, EventTarget, FocusEventTarget,
MouseEventTarget, WheelEventTarget, KeyboardEventTarget, LoadEventTarget, TouchEventTarget, ToggleEventTarget {
MouseEventTarget, WheelEventTarget, KeyboardEventTarget, LoadEventTarget, TouchEventTarget, ToggleEventTarget,
InputEventTarget {
@Override
public abstract NodeList<? extends HTMLElement> getElementsByTagName(String name);