achingbrain/bbq — Issue #9: Unexpected side effect bbq.domain.Entity.registerListener
Author: alanshaw
Created: 2012-02-27 17:41:22+00:00
State: open

If an entity has not "loaded", calling registerListener has the unexpected side effect of calling loadData if the event type is "onDataLoaded".

Whilst I agree that the callback should be called immediately if the object is loaded, I don't agree with the side effect. My initial reaction was to register the listener and then call loadData explicitly when I wanted to start the load.

Also, just another minor point: This method is documented as private - should it be? If so then it should probably start with an underscore to follow convention and if not we should get rid of the annotation so that it appears in the jsdocs.