addObjectNotify is used to get the notifications about specific model's object, not the model itself. For example:
obj1 = Model.create(...)
if you want to get model notifications, you should use setModelNotification
Model is not an "object" (in this context) , model is the "class definition" for the model's objects. You define the model, then you create objects (instances) of that model.
I think I chose bad variable names in my quick example code. I do want to get notified when an object (an instantiation of the model) is synced with the RhoConnect server.
I'll try to use more correct names in explaining what I am trying to accomplish.
- Create an object of a model on a page (model = Incident, object = newIncident)
- Set and save attributes of that object (name = 'test', description = 'my test', etc...)
- Capture a photo from the device's camera
- Save photo (model = Media, object = newMedia)
- Sync newIncident object with the backend which should return a new incident.id (from backend database)
- Store incident.id in newMedia object
- Sync newMedia object with the backend
So I need to first create the incident, get the id and store that id with the photo that was captured. I assume for all of that, I need to be listening for a specific object sync change and not an entire model.