- bottom has simple key value - dot syntax example
- bottom has examples for manually notifying observers
psuedocode for user action synchronization:
// Time that it may be safe to advance to if no more user actions have
// happened prior.
time potentiallySafe = now;
duration timeSince = now - action.time;
// `UserAction` instance happened now or in the past
if(timeSince >= 0) {
// if no more actions happened before time potentiallySafe
if(potentiallySafe - action.time > 0) {
// we can advance time up until previous user actions
g_safe = potentiallySafe;
}
// perform `UserAction` instance
action.perform();
// potentially allow time to advance to most recently applied user
// action
potentiallySafe = action.time;
}
UserAction.perform:
obj = g_objects.getAtKeyPath(this.path)
switch this.method:
case "CREATE":
// assuming path is to an array
obj.create(attributes);
case "UPDATE":
// assuming path is to an array
obj.get(attributes.id).set(attributes);
case "DELETE":
// assuming path is to an array
obj.delete(attributes.id);
Model.Collection.create(json attributes): [[this.type alloc] init]