In my case, there are three kinds of modules in my extension.
First is the Handler, like your module, each handler has their own switch.
The module unit is an instance of the "Handler" Object.
The code of command handler in my version is here. It has its own UI, UI event and handler logic.
But the first module apporach is not modular enough, it's still a piece of code, the user needs to open the file (popup.js), and insert the code, register the module (In fact, it is "register the switch UI", the registration is done in "Handler constructor"). It's hard for a packed chrome extension, even you download its zip and load the directory in develope mode, I think modifying the code is still too hard for the normal user (you need find the correct position to insert the code).
So I start the second apporach, which is the game module. its module unit is an file, and the registry is also a file.
Here's an example of guess number game:
And the code also contains the UI part, logic part, like the Handler. But it's still too hard for a packed extension user to add the plugins (they need findout where chrome store the extension folder), but for a unpacked extension user, then can add game module by file, and just change the registry file (which is more clear for the first one)
Both of the apporaches are not that easy to plug modules for a packed extension user (install via webstore), and I want to make a module webstore for the users, so they can plug modules more eaiser. The two method need add the module before you load the extension (may add the module then reload), while I what make it into hot plugging. That means I need to run the code while runtime. But the "eval" function is not recommand in chrome extension. So I design a programming language and provide a interpreter for it.
There are four components in the extension now, contnet script (insert into drrr.com's page), background page(event handler), popup page (the user interface), and exntesion pages (settings, script console), I have tried the background page and extension pages, and they works fine, but I haven't do the UI things by the language yet, if I want to plug the UI, I need to load the interpreter to popup page. The thrid appoarch for module now is like language package, you can download the module via code base repository (GitHub or Gitee).
I would combine the second apporach and thried apporch finally. Download the langauge module file and feed it to the interpreter on popup page, to achieve effect of second apporach.
Here's all my experience about making module for extension, but it is limited by the chrome, other browsers cannot run the extension, and the code may be not elegant enough for other developers to participate in. Hope your work can overcome the points I mentioned. By the way, I am thinking about the CORS issue. I do ajax for some api by the chrome background page, and I add the website permission to the extension to make the ajax works. I don't know whether some ajax requests (cross site) are allowed in userscript we plugged on drrr.com.