Currently there are 5 events that can be listened for using model#on.
3 of these events are GoInstant key events, add, set, remove which can take an optionsObject and a listener:
model.$on('add', { local: true }, function() {})
model.$on('set', { bubble: true, listener: function() {} })
model.$on('remove', function() {})
The other 2 are ready and error which do not take an options object:
model.$on('ready', function() {})
model.$on('error', function(errObj) {})
These inconstancies could make the method confusing because how you call the method changes based on the eventName you passed.
- With/without optsObj depending on the event being listened for
- Listeners with different signatures depending on the event being listened for
Some alternative interface ideas:
Separate the key events from the local model events
model.$key.on // for 'add', 'set', 'remove' key events
model.$on // for model-only events ('ready', 'error')
// error and ready events given their only method that calls a listener
model.$error
model.$ready
// reserve model.$on for key events
model.$on('add', optsObj, listener);