Skip to content

Commit

Permalink
jso: add InputEvent (#902)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ihromant authored Aug 14, 2024
1 parent 8c15885 commit 2805631
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 1 deletion.
26 changes: 26 additions & 0 deletions jso/apis/src/main/java/org/teavm/jso/dom/events/InputEvent.java
Original file line number Diff line number Diff line change
@@ -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();
}
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
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;
Expand All @@ -32,7 +33,8 @@
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);

Expand Down

0 comments on commit 2805631

Please sign in to comment.