diff --git a/src/js/background/messageHandler.js b/src/js/background/messageHandler.js index 6e5fced7..07cce776 100644 --- a/src/js/background/messageHandler.js +++ b/src/js/background/messageHandler.js @@ -90,6 +90,27 @@ const messageHandler = { } response = assignManager.storageArea.get(message.url); break; + case "getAssignmentObjectByContainer": + if (typeof message.userContextId === "undefined") { + throw new Error("Missing message.userContextId"); + } + response = Object.values(assignManager.storageArea.getByContainer(message.userContextId)); + break; + case "setAssignment": + if (typeof message.userContextId === "undefined") { + throw new Error("Missing message.userContextId"); + } + if (typeof message.neverAsk === "undefined") { + throw new Error("Missing message.neverAsk"); + } + response = assignManager.storageArea.set(message.url, { userContextId: message.userContextId, neverAsk: message.neverAsk}); + break; + case "removeAssignment": + if (typeof message.url === "undefined") { + throw new Error("Missing message.url"); + } + response = assignManager.storageArea.remove(message.url); + break; default: throw new Error("Unknown message.method"); } @@ -211,4 +232,4 @@ const messageHandler = { }; // Lets do this last as theme manager did a check before connecting before -messageHandler.init(); +messageHandler.init(); \ No newline at end of file