Hi All, I seem to be having an issue exposing JS f...
# javascript
s
Hi All, I seem to be having an issue exposing JS functions? Im not sure if its something got to do with the interfacing or something different. Its within a Multiproject system generating a Android / iOS / JS lib I have a function that I export
Copy code
//JS LAYER

@ExperimentalJsExport
@JsExport
fun authService() : AuthService = CoreAPI.authService
Inside the function it calls a Object singleton to return the auth service
Copy code
// COMMON LAYER
object CoreAPI : CoreAPIService {

    override val authService: AuthService = KAuthService(storage)

}
The implementation of the Auth service is the following interface
Copy code
//COMMON LAYER
class KAuthService(
    storage: Storage,
    private val credentialsManager: CredentialsManager = KCredentialsManager(storage)
) : AuthService {

    override fun login(
        loginRequest: LoginRequest,
        onSuccess: (Unit) -> Unit,
        onError: (KError) -> Unit
    ) {
        LoginInteractor(loginRequest, onSuccess, onError, credentialsManager = credentialsManager).execute()
    }

}        

interface AuthService {

    fun login(loginRequest: LoginRequest,
              onSuccess: (Unit) -> Unit,
              onError: (KError) -> Unit)

}
Where its odd is trying to access it in JS doesnt show the login method. Or even contain it in the compiled code? Im a little lost as I can make it work with direct classes. I think its an interface issue but not too sure?