Rudy Sulley
01/15/2024, 10:26 AMimplementation(npm("firebase", "10.7.1"))
created a file firebase.kt
fun FIREBASE_CONFIG(): String = js(
"""
({
apiKey: '',
authDomain: '',
projectId: '',
storageBucket: '',
messagingSenderId: '',
appId: '',
})
"""
)
@JsModule("firebase/app")
external object FirebaseApp {
fun initializeApp(config: String): FirebaseApp
}
@JsModule("firebase/auth")
external object FirebaseAuth {
fun getAuth(app: FirebaseApp): FirebaseAuth
fun connectAuthEmulator(auth: FirebaseAuth, url: String)
}
initialized in App.kt
val firebase = FirebaseApp.initializeApp(FIREBASE_CONFIG())
I get this error in the browser
FirebaseError: Firebase: Need to provide options, when not being deployed to hosting via source
After trying to create a JS object using the solutions in this https://stackoverflow.com/questions/28150124/javascript-anonymous-object-in-kotlin
Using this method listed in the answers
inline fun jsObject(init: dynamic.() -> Unit): dynamic {
val o = js("{}")
init(o)
return o
}
I get Unsupported [Dynamic types are not supported in this context]
Maybe I'm taking this all wrongly, need some pointers,
disclaimer
I'm trying out kotlin/wasm for the first time, haven't used kotlin/js before tooDavid Herman
01/15/2024, 7:17 PMDavid Herman
01/15/2024, 7:18 PMRudy Sulley
01/15/2024, 11:10 PMDavid Herman
01/15/2024, 11:21 PMJoel Denke
01/31/2024, 7:20 AMDavid Herman
01/31/2024, 4:19 PMJoel Denke
01/31/2024, 4:21 PMDavid Herman
01/31/2024, 4:24 PMRudy Sulley
01/31/2024, 4:57 PMRudy Sulley
07/05/2024, 8:19 AM