package js
Available on js
Generate JavaScript syntax not directly supported by Haxe. Use only at low-level when specific target-specific code-generation is required.
staticcode(code:String, args:Rest<Dynamic>):DynamicInject code directly into generated source.
code must be a string constant.
Additional args are supported to provide code interpolation, for example:
Syntax.code("console.log({0}, {1})", "hi", 42); will generate
console.log("hi", 42); Emits a compilation error if the count of args does not match the count of placeholders in code.
staticconstruct<T>(cl:Class<T>, args:Rest<Dynamic>):Tstaticconstruct(cl:String, args:Rest<Dynamic>):DynamicGenerate new cl(...args) expression.
staticdelete(o:Dynamic, f:String):Boolstaticdelete(o:Dynamic, f:Int):BoolGenerate delete o[f] expression.
staticfield(o:Dynamic, f:String):DynamicGenerate o.f expression, if f is a constant string, or o[f] if it's any other expression.
staticinstanceof(v:Dynamic, cl:Class<Dynamic>):BoolGenerate v instanceof cl expression.
staticplainCode(code:String):DynamicInject code directly into generated source. The same as js.Syntax.code except this one does not provide code interpolation.
staticstrictEq(a:Dynamic, b:Dynamic):BoolGenearte a === b expression.
staticstrictNeq(a:Dynamic, b:Dynamic):BoolGenearte a !== b expression.
statictypeof(o:Dynamic):StringGenerate typeof o expression.
© 2005–2020 Haxe Foundation
Licensed under a MIT license.
https://api.haxe.org/js/Syntax.html