Closed kevinresol closed 4 years ago
I'm completely unsure where we could place extern __init__
code and have it be effective. How is that handled in hxgenjs?
In this specific case you probably just want to define react_no_inline
Yeah it's used for jsx inlining.. though do you even use jsx()
?
How is that handled in hxgenjs?
I can't recall. Perhaps I just used react_no_inline
though do you even use
jsx()
?
Generally no, yeah. Just happen I am experimenting with something...
How bad is the impact if the value is moved to a static variable, say ReactType.__tre
?
No idea, what do you think @elsassph?
Hey there :)
In the case of React, we generate "global code", where $$tre
will be used in every render function.
In Haxe Modular the approach I used was to actually duplicate any top level $*
variable in the bundles (not even checking whether they are used). But that's kind of a self-serving hack.
Could it be attached to a class? Yes that could be a cleaner option. It should be hidden from completion though so maybe it could be created purely in macro.
It should be hidden from completion
@:noCompletion
should do the job.
as for genes on this problem, maybe it should just emit a warning for __init__
on extern class
Closed this with a warning here. Someday it might make sense to be able to configure for each extern if you want extern __init__
code either appear before main()
or in every file the extern is used.
This line of code doesn't seem to appear anywhere in the generate js files. But even if it does I doubt it would work at all.
The magic value is later used in some react render functions:
cc @klabz