Open bmorwood opened 10 years ago
so would we just have two the two methods? register() for events, makes sense to me and extend for anything you are adding to your class a prototype? what about create() for anything you want to create a new new instance of and not extend? or would you just use the 'new' statement?
I'm not sure. I think we play it by ear. If we find we have the need for a feature or method we could look at implementing it then. Hopefully at that time, enough of the API will have been flushed out that we'll know exactly how to implement it. Or at the very least, have a better idea of which direction we're taking.
Maybe for something like
new myapp.events.BlahEvent(myapp.Events.BlahEvent.OPEN).emit();
we use
myapp.events.emit(myapp.events.BlahEvent.OPEN);
or
myapp.events.BlahEvent.emit('OPEN');
we can have an emit on the static class and have it do the create or what have you behind the scenes. It's cleaner (user doesn't have to worry about clean up or instantiation).
Looking over a lot of frameworks, the convention seems to follow:
We could probably shorten this.. if we reserve the 'Chaos' namespace so that it just becomes.
I think I like that better.. again less to type. We can keep stuff organized in the Core folder, but then just make that assumption. 95% of everything will be in the core anyway.
For your own reference: