extern class File {
public static function GetPath(id:String):String;
}
how to use it in Main.hx, in Utils.hx without declaring in each file?
extern class File {
public static function GetPath(id:String):String;
}
how to use it in Main.hx, in Utils.hx without declaring in each file?
If you put the extern class definition in File.hx
then you can do File.GetPath
in both Main.hx
and Utils.hx
.
If you want to avoid the File.
part you can import your function with import File.GetPath;
and now you’ll have access to GetPath
just like if it was in your current class.
And if it’s something you use everywhere you could put the import in the import.hx.
© 2018-2020 Haxe Foundation - Powered by Discourse