Skip to content

Commit 1c8e1ac

Browse files
committed
Events. Safary WA for TouchEvent companion (#2449)
1 parent 1c2010d commit 1c8e1ac

File tree

2 files changed

+7
-0
lines changed
  • build-logic/generatorlegacybuild/src/main/kotlin/karakum/browser
  • kotlin-browser/src/commonMain/generated/web/uievents

2 files changed

+7
-0
lines changed

build-logic/generatorlegacybuild/src/main/kotlin/karakum/browser/Events.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,11 @@ private fun event(
306306
}
307307
""".trimIndent()
308308

309+
// WA for desktop Safari
310+
if (name == "TouchEvent") {
311+
eventBody = "@JsName(\"globalThis.$name\")\n$eventBody"
312+
}
313+
309314
eventBody = eventBody
310315
.withComment(
311316
fullSource = source,

kotlin-browser/src/commonMain/generated/web/uievents/TouchEvent.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ package web.uievents
44

55
import js.reflect.unsafeCast
66
import web.events.EventType
7+
import kotlin.js.JsName
78
import kotlin.js.definedExternally
89

910
/**
1011
* The **`TouchEvent`** interface represents an UIEvent which is sent when the state of contacts with a touch-sensitive surface changes.
1112
*
1213
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TouchEvent)
1314
*/
15+
@JsName("globalThis.TouchEvent")
1416
open external class TouchEvent(
1517
override val type: EventType<TouchEvent>,
1618
init: TouchEventInit = definedExternally,

0 commit comments

Comments
 (0)