Haxe for javascript without global namespace pollution?

后端 未结 4 805
無奈伤痛
無奈伤痛 2021-02-06 04:54

This question only applies to Haxe version < 2.10

I\'ve known about haxe for a while, but never really played with it until yesterday. Being curious,

4条回答
  •  不知归路
    2021-02-06 05:04

    Haxe is not meant to be used for writing an isolated reusable component in a javascript web application. This is evidenced by the fact that the compiler emits standard library for every goddamn compilation. Most optimal use of javascript target is to write an application entirely in haxe and call external stuff using untyped blocks hoping it won't break anything. You should treat haxe output like a flash clip, oblivious to the environment it runs in, assumes it is the only thing running.

    Or you might try wrapping the code with a with() block.

提交回复
热议问题