Can we pass the doc object into it's event calls?
"It doesn't look like the doc is passed in the event, but it seems like that would be very useful. It should be trivial to add the doc to the data passed in all those events - make a pull request and see if it's accepted." --David Grieson
When we are hard coding in ShareJS we know the number and names of all fields we are tying to docs and can hard code each individual function used for an event. We are normally repeating the same thing over and over again, where if we had the context we could write one function to explain a complex behaviour, and then just have it change which field it looks at based on who called it.
Even better, this would give greater flexibility to use share iteritively, like attaching all the fields in a form, regardless of how many or what names. Share is not set up to actively support this, but i recently put an example on your mailing list of how it can already be done. It uses the field names to hierachically name the documents, and thus from the document names it can fetch the field name... The problem is this can't be done with events at the moment. IF however, we could pass the doc as part of the event we could easily do it.
I hope anyone else thinks this would be as useful as i do, if i could make this change on my own version i would, so if someone figures out how it can be done i'd love to test it on a system i'm working on, hit me up on the Mailling list :-)