From e8557e7fd10d9ffa8ae180d5e6bf90721b408829 Mon Sep 17 00:00:00 2001
From: Unknown
Date: Thu, 5 Apr 2018 20:57:25 +0100
Subject: realise that delete exists
---
pkg93.js | 39 +++++++++++++++++++--------------------
1 file changed, 19 insertions(+), 20 deletions(-)
diff --git a/pkg93.js b/pkg93.js
index 33095d6..62f759d 100644
--- a/pkg93.js
+++ b/pkg93.js
@@ -126,32 +126,31 @@ var pkg93 = {
},
rm: function(pkg) {
var request = new XMLHttpRequest();
- if (!!localStorage[".pkg93/packages/" + pkg + ".rm.js"]) {
+ var index = config.installed.indexOf(pkg);
+ if (index < 0) {
+ $log("ERR Not found.");
+ return false;
+ } else if (!!localStorage[".pkg93/packages/" + pkg + ".rm.js"]) {
eval(localStorage[".pkg93/packages/" + pkg + ".rm.js"]); // Typing eval makes me feel dirty.
+ delete le._apps[config.installed[index]];
delete localStorage[".pkg93/packages/" + pkg + ".rm.js"]
delete localStorage[".pkg93/packages/" + pkg + ".js"]
delete localStorage[".pkg93/packages/" + pkg + ".json"]
} else {
- var index = config.installed.indexOf(pkg);
- if (index < 0) {
- $log("ERR Not found.");
- return false;
- } else {
- try {
- if (le._apps[config.installed[index]] === null) {
- $log("ERR Already removed.");
- } else {
- delete le._apps[config.installed[index]];
- delete localStorage[".pkg93/packages/" + config.installed[index] + ".js"];
- delete localStorage[".pkg93/packages/" + config.installed[index] + ".json"];
- config.installed.splice(index, 1);
- $log("OK Removed!");
- }
- return true;
- } catch (err) {
- $log("ERR " + err.message);
- return false;
+ try {
+ if (le._apps[config.installed[index]] === null) {
+ $log("ERR Already removed.");
+ } else {
+ delete le._apps[config.installed[index]];
+ delete localStorage[".pkg93/packages/" + config.installed[index] + ".js"];
+ delete localStorage[".pkg93/packages/" + config.installed[index] + ".json"];
+ config.installed.splice(index, 1);
+ $log("OK Removed!");
}
+ return true;
+ } catch (err) {
+ $log("ERR " + err.message);
+ return false;
}
}
}
--
cgit v1.2.3