Skip to content

Instantly share code, notes, and snippets.

Created Dec 12, 2017
What would you like to do?
Kotlin definitions for browser touch API
package browser
import org.w3c.dom.Element
typealias TouchId = Int
external interface Touch {
val identifier: TouchId
val target: Element
val screenX: Double
val screenY: Double
val clientX: Double
val clientY: Double
val pageX: Double
val pageY: Double
external open class TouchList {
val length: Int
fun item(index: Int): Touch?
operator fun TouchList.get(n: Int) =
item(n) ?: throw IndexOutOfBoundsException("index out of bounds: $n, length: $length")
external open class TouchEvent : UIEvent {
val shiftKey: Boolean;
val ctrlKey: Boolean;
val altKey: Boolean;
val metaKey: Boolean;
* See [DOM Level 3 Events spec]( for a list of valid (case-sensitive) arguments to this method.
fun getModifierState(key: String): Boolean;
val touches: TouchList;
val changedTouches: TouchList;
val targetTouches: TouchList;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment