I'm trying to implement a proof-of-concept react a...
# javascript
j
I'm trying to implement a proof-of-concept react app with Kotlin/JS and react. Ideally, I want to use only kotlin code. The app is for a 3rd party website and sits inside an iframe. The 3rd party provides a JavaScript API by means of including a script in the HTML body. In my react app, is it possible for kotlin/react to "see" this JavaScript code which is included in the index.html file? In a normal react app, I can reference this api without any require statements. Simply including the script tag in the HTML exposes everything to other JS files.
I've seen docs about including npm dependencies and providing kotlin wrappers for pure js stuff. But haven't seen anything online about referencing other script sources included in the html file
t
In my react app, is it possible for kotlin/react to “see” this JavaScript code which is included in the index.html file?
Looks like
external
API
j
So I can just treat it like any other dependency and make a kt file with the wrappers that reference the content of the API, like with the
@JsModule
annotation? Or are no annotations needed?
I figured this out. Indeed a simple external declaration is needed. It works extremely easily