aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac <arunisaac@systemreboot.net>2023-04-24 15:25:40 +0100
committerArun Isaac <arunisaac@systemreboot.net>2023-04-24 15:32:54 +0100
commit23f11afacdfe755ffa514a8cbf93ba1121b9db0d (patch)
tree7bb8f06724dc33ad45af7dde3dabf638f6af1e23
parent4b7294cfb8fda9d4612c1772b01b26949bb6911d (diff)
downloadguix-23f11afacdfe755ffa514a8cbf93ba1121b9db0d.tar.gz
guix-23f11afacdfe755ffa514a8cbf93ba1121b9db0d.zip
Add mumi config.
* .mumi/config: New file. * .gitignore: Add .mumi/current-issue.
-rw-r--r--.gitignore1
-rw-r--r--.mumi/config3
2 files changed, 4 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 34414d1e95..543dc1c655 100644
--- a/.gitignore
+++ b/.gitignore
@@ -159,3 +159,4 @@ tmp
/gnu/packages/aux-files/guile-guile-launcher.o
/guile
.DS_Store
+.mumi/current-issue \ No newline at end of file
diff --git a/.mumi/config b/.mumi/config
new file mode 100644
index 0000000000..6823e1c425
--- /dev/null
+++ b/.mumi/config
@@ -0,0 +1,3 @@
+((debbugs-host . "debbugs.gnu.org")
+ (patch-email-address . "guix-patches@gnu.org")
+ (mumi-host . "issues.guix.gnu.org"))
promise = is_chrome ?
- new Promise((resolve, reject) =>
- chrome.storage.local.get(key,
- val => resolve(val))) :
- browser.storage.local.get(key);
-
- return (await promise)[key];
- } catch (e) {
- console.log(e);
- }
-}
-
-async function set(key, value)
-{
- try {
- return browser.storage.local.set({[key]: value});
- } catch (e) {
- console.log(e);
- }
-}
-
-async function setn(keys_and_values)
-{
- let obj = Object();
- while (keys_and_values.length > 1) {
- let value = keys_and_values.pop();
- let key = keys_and_values.pop();
- obj[key] = value;
- }
-
- try {
- return browser.storage.local.set(obj);
- } catch (e) {
- console.log(e);
- }
-}
-
-async function set_var(name, value)
-{
- return set(TYPE_PREFIX.VAR + name, value);
-}
-
-async function get_var(name)
-{
- return get(TYPE_PREFIX.VAR + name);
-}
-
-/*
- * A special case of persisted variable is one that contains list
- * of items.
- */
+/* A special case of persisted variable is one that contains list of items. */
async function get_list_var(name)
{
- let list = await get_var(name);
+ let list = await raw_storage.get_var(name);
return list === undefined ? [] : list;
}
@@ -97,7 +38,7 @@ async function list(prefix)
let map = new Map();
for (let item of await get_list_var(name))
- map.set(item, await get(prefix + item));
+ map.set(item, await raw_storage.get(prefix + item));
return {map, prefix, name, observable: observables.make(),
lock: make_lock()};
@@ -175,19 +116,19 @@ async function set_item(item, value, list)
}
async function _set_item(item, value, list)
{
- let key = list.prefix + item;
- let old_val = list.map.get(item);
+ const key = list.prefix + item;
+ const old_val = list.map.get(item);
+ const set_obj = {[key]: value};
if (old_val === undefined) {
- let items = list_items(list);
+ const items = list_items(list);
items.push(item);
- await setn([key, value, "_" + list.name, items]);
- } else {
- await set(key, value);
+ set_obj["_" + list.name] = items;
}
- list.map.set(item, value)
+ await raw_storage.set(set_obj);
+ list.map.set(item, value);
- let change = {
+ const change = {
prefix : list.prefix,
item,
old_val,
@@ -212,20 +153,21 @@ async function remove_item(item, list)
}
async function _remove_item(item, list)
{
- let old_val = list.map.get(item);
+ const old_val = list.map.get(item);
if (old_val === undefined)
return;
- let key = list.prefix + item;
- let items = list_items(list);
- let index = items.indexOf(item);
+ const items = list_items(list);
+ const index = items.indexOf(item);
items.splice(index, 1);
- await setn([key, undefined, "_" + list.name, items]);
-
+ await raw_storage.set({
+ [list.prefix + item]: undefined,
+ ["_" + list.name]: items
+ });
list.map.delete(item);
- let change = {
+ const change = {
prefix : list.prefix,
item,
old_val,
@@ -247,11 +189,11 @@ async function replace_item(old_item, new_item, list, new_val=undefined)
}
async function _replace_item(old_item, new_item, list, new_val=undefined)
{
- let old_val = list.map.get(old_item);
+ const old_val = list.map.get(old_item);
if (new_val === undefined) {
if (old_val === undefined)
return;
- new_val = old_val
+ new_val = old_val;
} else if (new_val === old_val && new_item === old_item) {
return old_val;
}
@@ -261,17 +203,18 @@ async function _replace_item(old_item, new_item, list, new_val=undefined)
return old_val;
}
- let new_key = list.prefix + new_item;
- let old_key = list.prefix + old_item;
- let items = list_items(list);
- let index = items.indexOf(old_item);
+ const items = list_items(list);
+ const index = items.indexOf(old_item);
items[index] = new_item;
- await setn([old_key, undefined, new_key, new_val,
- "_" + list.name, items]);
+ await raw_storage.set({
+ [list.prefix + old_item]: undefined,
+ [list.prefix + new_item]: new_val,
+ ["_" + list.name]: items
+ });
list.map.delete(old_item);
- let change = {
+ const change = {
prefix : list.prefix,
item : old_item,
old_val,