Skip to content

Commit

Permalink
Small changes.
Browse files Browse the repository at this point in the history
Sidenote: Is `Any?` any different from `<T>` ? The documentation shows
properties using `Any?`. However, `<T>` worked as well
  • Loading branch information
tanelso2 committed Apr 22, 2024
1 parent fbccfc1 commit 6791e4f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/jsMain/kotlin/HTMLInputHelpers.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import kotlin.reflect.KProperty
fun getInputElem(s: String): HTMLInputElement =
document.getElementById(s) as HTMLInputElement

class HTMLInputProperty<T>(private val input: HTMLInputElement): ReadOnlyProperty<T, Double> {
override fun getValue(thisRef: T, property: KProperty<*>): Double = input.valueAsNumber
class HTMLInputProperty(private val input: HTMLInputElement): ReadOnlyProperty<Any?, Double> {
override fun getValue(thisRef: Any?, property: KProperty<*>): Double = input.valueAsNumber
}

fun <T> HTMLInputProperty(s: String): HTMLInputProperty<T> {
fun HTMLInputProperty(s: String): HTMLInputProperty {
val elem = getInputElem(s)
return HTMLInputProperty(elem)
}
Expand Down
2 changes: 1 addition & 1 deletion src/jsMain/kotlin/ResourceLoader.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class ResourceLoader(vararg resourceLocations: String) {
private val fetchParams = RequestInit(method = "GET", cache = RequestCache.NO_STORE, mode = RequestMode.SAME_ORIGIN)
init {
for (loc in resourceLocations) {
resourceMap.put(loc, ResourceInfo())
resourceMap[loc] = ResourceInfo()
makeRequest(loc)
}
}
Expand Down

0 comments on commit 6791e4f

Please sign in to comment.