Skip to content

Instantly share code, notes, and snippets.

@stripethree
Last active February 25, 2017 17:52
Show Gist options
  • Save stripethree/6cf56f921dd9350e2aefe0410f2b54d7 to your computer and use it in GitHub Desktop.
Save stripethree/6cf56f921dd9350e2aefe0410f2b54d7 to your computer and use it in GitHub Desktop.
routeEachMessage(messagingEvent) {
const cacheKey = messagingEvent.sender.id;
return cache.get(cacheKey)
.then((session = {_key: cacheKey, count: 0}) => {
// check if profile info is already in the session,
// if not, fetch it from Graph API
})
.then((session) => {
session.count++;
if (messagingEvent.message) {
this.onMessage(messagingEvent, session);
} else {
}
})
.then((session) => this.saveSession(session));
}
@stripethree
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment