在我的haxe项目中,我的目标是javascript,并使用@:expose来自外部haxe项目的类来公开类.
在我的Main班上,我instance用来访问单音班.
喜欢:
com.Main.instance
现在,当我尝试访问ini类中的函数时,它仅在使用Chrome时才有效,但在Firefox中会出错:
TypeError: com.Main.instance is undefined
知道为什么它在Chrome上运行,但在Firefox中却没有?
我使用的是haxe 3.4.0版
更新了 我添加最小化的haxe示例文件来重现问题
package com;
import js.Browser;
@:expose
class Main {
/*
Using this var results in undefined
example at Firefox console:
>> com.Main.instance
undefined
*/
@isVar public static var instance(get, null):Main = null;
static function get_instance():Main {
if (instance == null)
instance = new Main();
return instance;
}
function new() {
}
static function main() {
trace('Hello World');
}
/* …Run Code Online (Sandbox Code Playgroud) haxe ×1