Anyone can say how I can describe in jsruntime pro...
# javascript
m
Anyone can say how I can describe in jsruntime property that is function in my external interface?
j
(Corrected
native
to
external
- I just mis-remembered) I believe you can use
external
declarations to accomplish what you are looking for. Example of an external declaration:
external fun Window.atob(value: String): String
The above would give you access to this: https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/atob External declarations are more or less a statement of, "at runtime, this function/field will be available and will be structured like this."
m
actually I’ve got access to this methods with
external
keyword
Copy code
/**
 * <https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/onInstalled>
 */
external interface OnInstalled {
    fun hasListeners(): Boolean
    fun hasListener(listener: EventListener): Boolean
    /**
     * @param details
     */
    fun addListener(listener: (Details) -> Unit)
    fun removeListener(details: Details)
}
but didn’t understand how to get properties
j
You are correct. You can do properties the same way.
I mis-remembered the keyword. It's external.
external val Something.nameOfField: Type