Hello! How to add class/object static initializer ...
# javascript
p
Hello! How to add class/object static initializer in js generated code to be able to execute on js start without explicitly calling from main
Copy code
object Test {
  init { // want to execute it on js start without calling Test from main method
    window.alert("test")
  } 
}
q
JS doesn't support that yet, but it'll be a while before it gets released iirc.
t
You can add
main
fun as temp WA
p
I have several such objects. And I want to make some kind of compule time plugins using this pattern. main function doesn't feet cause at that point there is no information what objects needed.
q
You can write a static function and then call it after the class
👍 1
p
Could you provide simple example for that. From what context should i call that function?