1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-07-18 12:31:12 +02:00

add comments

This commit is contained in:
Kushagra Gour
2019-03-08 13:42:54 +05:30
parent edf71ce296
commit 8b15c479f4
2 changed files with 13 additions and 0 deletions

View File

@@ -206,6 +206,9 @@ export default class App extends Component {
// For web app environment we don't fetch item from localStorage, // For web app environment we don't fetch item from localStorage,
// because the item isn't stored in the localStorage. // because the item isn't stored in the localStorage.
if (lastCode.id && window.IS_EXTENSION) { if (lastCode.id && window.IS_EXTENSION) {
// In case of already saved item (with id), we fetch it from
// its real key instead of using `code` for better reliability.
// because `code` sets only on shady unloadbefore.
db.local.get(lastCode.id, itemResult => { db.local.get(lastCode.id, itemResult => {
if (itemResult[lastCode.id]) { if (itemResult[lastCode.id]) {
log('Load item ', lastCode.id); log('Load item ', lastCode.id);
@@ -466,6 +469,7 @@ export default class App extends Component {
/** /**
* Fetches all items from storage * Fetches all items from storage
* @param {boolean} shouldSaveGlobally Whether to store the fetched items in global arr for later use. * @param {boolean} shouldSaveGlobally Whether to store the fetched items in global arr for later use.
* @param {boolean} shouldFetchLocally Intentionally get local items. Used when importing local items to account.
* @return {promise} Promise. * @return {promise} Promise.
*/ */
async fetchItems(shouldSaveGlobally, shouldFetchLocally) { async fetchItems(shouldSaveGlobally, shouldFetchLocally) {

View File

@@ -11,6 +11,11 @@ export const itemService = {
return doc.data(); return doc.data();
}); });
}, },
/**
* Fetches user's item id list. CURRENTLY RUNS ONLY
* FOR LOGGED IN USER!!
*/
async getUserItemIds() { async getUserItemIds() {
if (window.user) { if (window.user) {
return new Promise(resolve => { return new Promise(resolve => {
@@ -29,6 +34,10 @@ export const itemService = {
}); });
}, },
/**
* Fetches all items FROM REMOTE ONLY CURRENTLY!!
* TODO: make it work for local too.
*/
async getAllItems() { async getAllItems() {
var t = Date.now(); var t = Date.now();
var d = deferred(); var d = deferred();