Skip to content

Commit

Permalink
use "add" topic for notifying store
Browse files Browse the repository at this point in the history
  • Loading branch information
neonstalwart committed Jan 11, 2015
1 parent 5c7796d commit 813a463
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions store/notifying.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,20 @@ exports.Notifying = function(store, options){
if(directives && directives['client-id']){
clientHub = hub.fromClient(directives['client-id']);
}
return clientHub.subscribe(path, /*directives.body || */["put", "delete"]);
return clientHub.subscribe(path, /*directives.body || */["add", "put", "delete"]);
};
store.unsubscribe = function(path, directives){
var clientHub = hub;
if(directives && directives['client-id']){
clientHub = hub.fromClient(directives['client-id']);
}
return clientHub.unsubscribe(path, ["put", "delete"]);
return clientHub.unsubscribe(path, ["add", "put", "delete"]);
};
var originalPut = store.put;
if(originalPut){
store.put= function(object, directives){
if(options && options.revisionProperty){
object[options.revisionProperty] = (object[options.revisionProperty] || 0) + 1;
object[options.revisionProperty] = (object[options.revisionProperty] || 0) + 1;
}
var result = originalPut(object, directives) || object.id;
if(directives && directives.replicated){
Expand All @@ -60,12 +60,12 @@ exports.Notifying = function(store, options){
var result = originalAdd(object, directives) || object.id;
if(directives && directives.replicated){
return result;
}
}
return when(result, function(id){
localHub.publish({
channel: id,
result: object,
type: "put"
type: "add"
});
return id;
});
Expand Down

0 comments on commit 813a463

Please sign in to comment.