Thanks Kevin for your answer.
I don’t think it solves my thing. I’ll try to detail what I mean.
Let’s say I have a regular class. In this class I deal with JS and this class is related to a template, let’s say it’s a html file. So basically, in this class I have a lot of
js.Browser.document.getElementById( "myID" );
I’ve written a little macro to which one I give the HTML file content and the id I’m looking for in order that my macro checks if this id really exists in this Html file.
So my macro is like that :
HtmlFile.getElementById( "templates/my_path.mtt", "my_id" ) and it works fine.
Now, as you can see, I always have to give the path of the Html file to my macro, even if it’s the same Html file that is used all along this regular JS class.
So my question is if I could do something like
var myHtmlFile = new MyMacro( "templates/my_path.mtt" );and then, all along my regular JS class, do something like
myHtmlFile.getElementById( "my-id" ); which will generate the regular code
js.Browser.document.getElementById( "my-id" );if the id exists or throw a compilation error if the id doesn’t exists (as my static macro does now, but without giving always the path to the Html file).
I hope it’s more clear now, and I thanks all that read that and try to answer.
Also if it’s not possible to do what I want this way, maybe there is another “shorter” whey than this static and path and id.