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:
@@ -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) {
|
||||||
|
@@ -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();
|
||||||
|
Reference in New Issue
Block a user