Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- return this._dbPromise.then(function(db) {
- // if we're already showing posts, eg shift-refresh
- // or the very first load, there's no point fetching
- // posts from IDB
- if (!db || indexController._postsView.showingPosts()) return;
- // TODO: get all of the wittr message objects from indexeddb,
- // then pass them to:
- // indexController._postsView.addPosts(messages)
- // in order of date, starting with the latest.
- // Remember to return a promise that does all this,
- // so the websocket isn't opened until you're done!
- var tx = db.transaction('wittrs');
- var store = tx.objectStore('wittrs');
- var timeIndex = store.index('by-date');
- return timeIndex.getAll();
- }).then(function(messages) {
- indexController._postsView.addPosts(messages);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement