Open migueldeicaza opened 1 year ago
I think constants narrowed to type would be better because not all object types receive the same notifications. The only ones on base Object
are POSTINITIALIZE
and PREDELETE
, then nodes and such add a bunch more. People might want to make their own custom notifications, too.
Update: we already surfaced all the constants in each type, so they are already there, we could reuse those to prototype at least.
I think that what needs to be done is to add a new virtual
open func notification(...)
Method in the generated Object, and then we would just call it from the notification callback in Wrapper.
Surface _notification, we are getting the event, they are just not being posted to the object yet.
Need to decide if we create a big "Notification" enum with all possible notifications, or if "Notification" should be narrowed to the type they are declared on, and whether it is an enum or a constant. In the former case, we can use an enum, in the latter case we would need to use constants, in case new subclasses introduce new notifications.