Skip to content

Instantly share code, notes, and snippets.

@barberdt
Last active November 19, 2015 16:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barberdt/c70e2c99d55fdfb2edaa to your computer and use it in GitHub Desktop.
Save barberdt/c70e2c99d55fdfb2edaa to your computer and use it in GitHub Desktop.
class AttachmentActions {
readPage(pageRecord) {
return AttachmentAPI.readPage(pageRecord)
.then(stuff => this.actions.readPageSuccess(stuff, pageRecord));
}
}
class AttachmentStore {
fetchNextPage() {
let pageRecord = this.getNextPageRecord();
let stuff = this.getStuffFromCache(pageRecord); // how do you maintain this?
if (hasInCache) {
return Promise.resolve(stuffFromCache);
}
return AttachmentActions.readPage(pageRecord)
.then(() => this.getStuffFromCache());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment