mirror of
https://github.com/chinchang/web-maker.git
synced 2025-07-16 11:36:20 +02:00
add offline enabled build process
This commit is contained in:
@ -473,7 +473,7 @@ globalConsoleContainerEl, externalLibrarySearchInput, keyboardShortcutsModal
|
||||
*/
|
||||
function fetchItems(shouldSaveGlobally) {
|
||||
var d = deferred();
|
||||
chrome.storage.local.get('items', function(result) {
|
||||
db.local.get('items', function(result) {
|
||||
var itemIds = Object.getOwnPropertyNames(result.items || {}),
|
||||
items = [];
|
||||
if (!itemIds.length) {
|
||||
@ -484,7 +484,7 @@ globalConsoleContainerEl, externalLibrarySearchInput, keyboardShortcutsModal
|
||||
trackEvent('fn', 'fetchItems', itemIds.length);
|
||||
for (let i = 0; i < itemIds.length; i++) {
|
||||
/* eslint-disable no-loop-func */
|
||||
chrome.storage.local.get(itemIds[i], function(itemResult) {
|
||||
db.local.get(itemIds[i], function(itemResult) {
|
||||
if (shouldSaveGlobally) {
|
||||
savedItems[itemIds[i]] = itemResult[itemIds[i]];
|
||||
}
|
||||
@ -572,20 +572,20 @@ globalConsoleContainerEl, externalLibrarySearchInput, keyboardShortcutsModal
|
||||
|
||||
itemTile.remove();
|
||||
// Remove from items list
|
||||
chrome.storage.local.get(
|
||||
db.local.get(
|
||||
{
|
||||
items: {}
|
||||
},
|
||||
function(result) {
|
||||
delete result.items[itemId];
|
||||
chrome.storage.local.set({
|
||||
db.local.set({
|
||||
items: result.items
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
// Remove individual item too.
|
||||
chrome.storage.local.remove(itemId, function() {
|
||||
db.local.remove(itemId, function() {
|
||||
alertsService.add('Item removed.');
|
||||
// This item is open in the editor. Lets open a new one.
|
||||
if (currentItem.id === itemId) {
|
||||
@ -1428,13 +1428,13 @@ globalConsoleContainerEl, externalLibrarySearchInput, keyboardShortcutsModal
|
||||
}
|
||||
if (mergedItemCount) {
|
||||
// save new items
|
||||
chrome.storage.local.set(toMergeItems, function() {
|
||||
db.local.set(toMergeItems, function() {
|
||||
alertsService.add(
|
||||
mergedItemCount + ' creations imported successfully.'
|
||||
);
|
||||
});
|
||||
// Push in new item IDs
|
||||
chrome.storage.local.get(
|
||||
db.local.get(
|
||||
{
|
||||
items: {}
|
||||
},
|
||||
@ -1443,7 +1443,7 @@ globalConsoleContainerEl, externalLibrarySearchInput, keyboardShortcutsModal
|
||||
for (var id in toMergeItems) {
|
||||
result.items[id] = true;
|
||||
}
|
||||
chrome.storage.local.set({
|
||||
db.local.set({
|
||||
items: result.items
|
||||
});
|
||||
trackEvent('fn', 'itemsImported', mergedItemCount);
|
||||
@ -1691,7 +1691,7 @@ globalConsoleContainerEl, externalLibrarySearchInput, keyboardShortcutsModal
|
||||
utils.log(settingName, el.type === 'checkbox' ? el.checked : el.value);
|
||||
prefs[settingName] = el.type === 'checkbox' ? el.checked : el.value;
|
||||
obj[settingName] = prefs[settingName];
|
||||
chrome.storage.sync.set(obj, function() {
|
||||
db.sync.set(obj, function() {
|
||||
alertsService.add('Setting saved');
|
||||
});
|
||||
trackEvent('ui', 'updatePref-' + settingName, prefs[settingName]);
|
||||
|
Reference in New Issue
Block a user