codecombat/codecombat — pull request #817 by rubenvereecken (2014-04-11 18:20:09+00:00)
Title: Validated Backbone Mediator integration 

This is a new and cleaner version of pull request #740. Had some tough luck over there.

Thanks to Scott I finally managed to get the new Backbone Mediator integrated as a Bower component. `bower install` should now hook you up with `v0.1.3`. Since the component is coco-centred, most changes made will go hand in hand with changes made to CodeCombat.

I'll make sure to edit the Subscriptions Wiki page before you send out your email (and you've had your time to give it a quick read). For now though, here's how things go:
There are definitions and subscriptions schemas. The latter define subscriptions (or events if you like). Empty subscriptions will be ignored by the backbone mediator so they're safe to `addChannelSchemas`. Definitions are used for objects that channel schemas can refer to. I added a `jQueryEvent` as example.

TODO for fellow archmages:
- `grep "TODO schema"` should tell you which schemas still need completion. Also browsing around CodeCombat will throw some warnings if it encounters channel subscriptions with no matching schema.
- Try to get general naming rules going. I noticed there was this tendency towards modularity with the use of `level:...` for example. Refactor! Ideally the `module:` part of a channel name points to the file where the channel is defined.
- Models should really be moved to `app` so they can be referred to as well. People will find the need when trying to refer to a user and the like.