Add hashchange event support

This commit is contained in:
Alexey Andreev 2015-10-17 20:59:29 +03:00
parent 53cd861563
commit d2468872fe
2 changed files with 39 additions and 0 deletions

View File

@ -19,6 +19,7 @@ import org.teavm.jso.dom.events.Event;
import org.teavm.jso.dom.events.EventListener;
import org.teavm.jso.dom.events.EventTarget;
import org.teavm.jso.dom.events.FocusEventTarget;
import org.teavm.jso.dom.events.HashChangeEvent;
import org.teavm.jso.dom.events.KeyboardEventTarget;
import org.teavm.jso.dom.events.LoadEventTarget;
import org.teavm.jso.dom.events.MessageEvent;
@ -45,4 +46,12 @@ public interface WindowEventTarget extends EventTarget, FocusEventTarget, MouseE
default void neglectMessage(EventListener<MessageEvent> listener) {
removeEventListener("message", listener);
}
default void listenHashChange(EventListener<HashChangeEvent> listener) {
addEventListener("hashchange", listener);
}
default void neglectHashChange(EventListener<HashChangeEvent> listener) {
removeEventListener("hashchange", listener);
}
}

View File

@ -0,0 +1,30 @@
/*
* 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.jso.dom.events;
import org.teavm.jso.JSProperty;
/**
*
* @author Alexey Andreev
*/
public interface HashChangeEvent extends Event {
@JSProperty
String getOldURL();
@JSProperty
String getNewURL();
}