COMMUNITY

Create static functions in @:genericBuild

I am generating per-generic-type types by using @:genericBuild. This works pretty well, but one thing that does not seem to work is to create static functions.

@:genericBuild(EventMacro.Build())
class Event<T : EventData>
{
}

To this I want to add a static function called Fire that does something specific for each that kind of event (pass a name and some parameters).

The syntax should be something like this: Event<ClickData>.Fire(), but the compiler does not like this. Can you guys think of something that might work?

Thanks :slight_smile:

Perhaps:

typedef ClickEvent = Event<ClickData>;
ClickEvent.Fire();

Thanks @kevinresol
I solved it in the end by using a simple interface and @:autobuild.
The @:genericBuild is a really cool feature but a bit too complex for what I wanted to achieve!