Skip to content

Instantly share code, notes, and snippets.

@Nepoxx
Created May 2, 2016 19:46
Show Gist options
  • Save Nepoxx/16751b68cb8b0009afda3f7dbc8f18cf to your computer and use it in GitHub Desktop.
Save Nepoxx/16751b68cb8b0009afda3f7dbc8f18cf to your computer and use it in GitHub Desktop.
this.addNewListener = function(user) {
joinChannel(user.name);
return addNewChannelCache(user)
.then(function(data) {
return cache.getAsync(user.name);
})
.then(function(obj) {
if (obj == null) {
throw new Exception('Object was not in cache');
} else {
io.of('/' + user._id);
return obj;
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment