Hacker News new | ask | show | jobs
by venuzr 3564 days ago
Is there a way to extend a running javascript app without restart. Say I have a Single Page APP (built on React if that matters) and I want to allow third party developers to add Components / modules/ themes/ plugins to a registry. I want to be able to allow end users to choose third party plugins from the registry to extend the capabilities of the SPA.

Is this possible? If so, is there any guidance on how to achieve this?

Thanks

1 comments

Sure it's possible. As an example, Odoo is a full Python webapp "platform", with a core upon which the user can choose and load plugins to add features (from a simple contact list to a full-blown ERP/CRM/accouting/CMS) and extensions to those features.

On the frontend side, when you install a module, it loads the .js file (using a regular <script> tag) which contains a single function. The Odoo core passes its main JS object (the base of the core API) to that function, which then initializes the whole module and uses the Odoo API to configure stuff, setup hooks, etc.

There's no security, though: by design, a module is trusted and can do anything on the platform. I'm not sure if and how one could contain them.

(Disclaimer: I'm a developer working for an Odoo partner, we write modules and host it as a SaaS.)

I don't speak Python, but on the client modules could run in web workers.