JeffHeard/ga_bigboard — pull request #23 by NathanRSmith (2012-08-16 16:26:43+00:00)
Title: Multicallbacks

Mainloop can now accept lists of callbacks per feature. Mobile script has also be adjusted to work with this new setup. So now instead of having an entry for each feature callback in the dict passed to Bigboard, a dict called callbacks can be passed with the following structure:

callbacks = {
loginSuccessful: [
logincallback1,
...
],
receivedRoom: [
roomcallback1,
...
],
receivedRoles: [
rolescallback1,
...
],
receivedParticipants: [
participantscallback1,
...
],
receivedChats: [
chatscallback1,
...
],
receivedOverlays: [
overlayscallback1,
...
],
receivedSharedOverlays: [
shared_overlayscallback1,
...
],
receivedAnnotations: [
annotationscallback1,
...
]
}

where each entry in the list per callback set is a function like before. There is also a new function called registerCallback which accepts the callback type (eg. "receivedAnnotations") and the callback function. Then instead of using the either function to call an individual callback, runCallbacks iterates over the list of callbacks for that feature and calls each one in order. This works well and I am using it successfully in my widgets.

See commits for other items.