Last active
November 19, 2015 16:01
-
-
Save barberdt/c70e2c99d55fdfb2edaa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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