Is there a way to access the root scope of the run...
# javascript
s
Is there a way to access the root scope of the running compiled js file?
t
What is root scope?
s
the outermost scope of the js file that the compiled Kotlin code is running
t
For export modification?
s
NewRelic offers something called synthetics that run some js code every x minutes. I’m compiling a Kotlin-js app and uploading that to the synthetic (It can only run a single file, but it’s basically a node.js environment). I’m uploading this compiled js to 3 different places, and each script has to be configured separately, so I’m letting people configure some settings in the header of the JS, and I need to find a way to be able to access them from my kotlin code.
t
During compilation?
s
after compilation
a
If they’re prepending some variable definitions to the kotlin/js output, those could presumably be accessed as free variables
doesn’t that basically just make them external properties?
1
s
If the config data is a read-only object, it might be more convenient to use
external object
instead of
external val
with
external interface