Ray Rahke
03/15/2024, 3:49 PMrequestAnimationFrame()
fun main() {
requestAnimationFrame(::main)
}
but receive
Unresolved reference: requestAnimationFrame
I have tried many combinations of imports, and all of them at once.
import kotlinx.browser.document
import kotlinx.browser.window
import org.w3c.dom.*
import org.w3c.dom.events.*
import kotlin.browser.window
What do I need to import to get access to this standard JS function?Joffrey
03/15/2024, 3:51 PMkotlinx.browser.window
is the one you need I believeRay Rahke
03/15/2024, 3:52 PMJoffrey
03/15/2024, 3:52 PMkotlin.browser.window
so I'm not sure how that compiles, you should probably remove that oneRay Rahke
03/15/2024, 3:52 PMimport kotlinx.browser.document
import kotlinx.browser.window
import org.w3c.dom.*
?Ray Rahke
03/15/2024, 3:52 PMJoffrey
03/15/2024, 3:53 PMimport kotlinx.browser.window
(not the 2 others), but yeah maybe you need the others for the rest of your codeJoffrey
03/15/2024, 3:53 PMwindow
object? Because you can't just call it directly. You need:
window.requestAnimationFrame { ... }
Ray Rahke
03/15/2024, 3:53 PMRay Rahke
03/15/2024, 3:54 PMRay Rahke
03/15/2024, 3:54 PMJoffrey
03/15/2024, 3:54 PMwindow
scope are not mixed upRay Rahke
03/15/2024, 4:16 PM