Search code examples
robotlegs

RobotLegs: Sending events between Models?


I've got two two RobotLegs models that are, by necessity, fairly tightly coupled. What's the best way to send events between them?

For example, I'd like to notify the AppleFarmerModel each time the AppleTreeModel dispatches an APPLE_READY event.


Solution

  • The way I would approach this would be to have the command that determines whether an apple is ready trigger another command that tells the Farmer to check the tree. This way you can get the farmer to check the tree even if they haven't heard anything which may be useful in the future.