mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
Add DOM APIs
This commit is contained in:
parent
be4457c285
commit
f138c837cf
|
@ -53,6 +53,8 @@ public interface XMLHttpRequest extends JSObject {
|
|||
@JSProperty("onreadystatechange")
|
||||
void setOnReadyStateChange(ReadyStateChangeHandler handler);
|
||||
|
||||
void overrideMimeType(String mimeType);
|
||||
|
||||
@JSProperty
|
||||
int getReadyState();
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ package org.teavm.dom.browser;
|
|||
|
||||
import org.teavm.dom.ajax.XMLHttpRequest;
|
||||
import org.teavm.dom.html.HTMLDocument;
|
||||
import org.teavm.dom.json.JSON;
|
||||
import org.teavm.dom.typedarrays.*;
|
||||
import org.teavm.jso.JSConstructor;
|
||||
import org.teavm.jso.JSGlobal;
|
||||
|
@ -46,6 +47,9 @@ public interface Window extends JSGlobal {
|
|||
|
||||
void clearInterval(int timeoutId);
|
||||
|
||||
@JSProperty("JSON")
|
||||
JSON getJSON();
|
||||
|
||||
@JSConstructor("XMLHttpRequest")
|
||||
XMLHttpRequest createXMLHttpRequest();
|
||||
|
||||
|
|
|
@ -100,4 +100,7 @@ public interface Node extends JSObject {
|
|||
String getLocalName();
|
||||
|
||||
boolean hasAttributes();
|
||||
|
||||
@JSProperty
|
||||
Document getOwnerDocument();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* Copyright 2015 Alexey Andreev.
|
||||
*
|
||||
* 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.dom.events;
|
||||
|
||||
import org.teavm.jso.JSProperty;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Alexey Andreev <konsoletyper@gmail.com>
|
||||
*/
|
||||
public interface KeyboardEvent extends Event {
|
||||
int DOM_KEY_LOCATION_STANDARD = 0x00;
|
||||
|
||||
int DOM_KEY_LOCATION_LEFT = 0x01;
|
||||
|
||||
int DOM_KEY_LOCATION_RIGHT = 0x02;
|
||||
|
||||
int DOM_KEY_LOCATION_NUMPAD = 0x03;
|
||||
|
||||
@JSProperty
|
||||
String getKey();
|
||||
|
||||
@JSProperty
|
||||
int getKeyCode();
|
||||
|
||||
@JSProperty
|
||||
String getCode();
|
||||
|
||||
@JSProperty
|
||||
int getLocation();
|
||||
|
||||
@JSProperty
|
||||
boolean isCtrlKey();
|
||||
|
||||
@JSProperty
|
||||
boolean isShiftKey();
|
||||
|
||||
@JSProperty
|
||||
boolean isAltKey();
|
||||
|
||||
@JSProperty
|
||||
boolean isMetaKey();
|
||||
|
||||
@JSProperty
|
||||
boolean isRepeat();
|
||||
|
||||
@JSProperty("isComposing")
|
||||
boolean isComposing();
|
||||
|
||||
boolean getModifierState(String keyArg);
|
||||
}
|
|
@ -16,13 +16,14 @@
|
|||
package org.teavm.dom.html;
|
||||
|
||||
import org.teavm.dom.core.Document;
|
||||
import org.teavm.dom.events.EventTarget;
|
||||
import org.teavm.jso.JSProperty;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Alexey Andreev <konsoletyper@gmail.com>
|
||||
*/
|
||||
public interface HTMLDocument extends Document {
|
||||
public interface HTMLDocument extends Document, EventTarget {
|
||||
@JSProperty
|
||||
@Override
|
||||
HTMLHtmlElement getDocumentElement();
|
||||
|
@ -38,4 +39,10 @@ public interface HTMLDocument extends Document {
|
|||
|
||||
@JSProperty
|
||||
HTMLElement getHead();
|
||||
|
||||
@JSProperty
|
||||
int getScrollLeft();
|
||||
|
||||
@JSProperty
|
||||
int getScrollTop();
|
||||
}
|
||||
|
|
|
@ -80,4 +80,26 @@ public interface HTMLElement extends Element, ElementCSSInlineStyle, EventTarget
|
|||
|
||||
@JSProperty
|
||||
String getAccessKeyLabel();
|
||||
|
||||
@JSProperty
|
||||
int getClientWidth();
|
||||
|
||||
@JSProperty
|
||||
int getClientHeight();
|
||||
|
||||
@JSProperty
|
||||
int getAbsoluteLeft();
|
||||
|
||||
@JSProperty
|
||||
int getAbsoluteTop();
|
||||
|
||||
@JSProperty
|
||||
int getScrollLeft();
|
||||
|
||||
@JSProperty
|
||||
int getScrollTop();
|
||||
|
||||
@JSProperty
|
||||
@Override
|
||||
HTMLDocument getOwnerDocument();
|
||||
}
|
||||
|
|
28
teavm-dom/src/main/java/org/teavm/dom/json/JSON.java
Normal file
28
teavm-dom/src/main/java/org/teavm/dom/json/JSON.java
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright 2015 Alexey Andreev.
|
||||
*
|
||||
* 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.dom.json;
|
||||
|
||||
import org.teavm.jso.JSObject;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Alexey Andreev <konsoletyper@gmail.com>
|
||||
*/
|
||||
public interface JSON extends JSObject {
|
||||
String stringify(JSObject object);
|
||||
|
||||
JSObject parse(String string);
|
||||
}
|
Loading…
Reference in New Issue
Block a user