nexushoratio / userscripts

Random userscripts for browsers.
GNU General Public License v3.0
2 stars 0 forks source link

base: Enhance `ensure()` to provide a filtered namespace. #175

Closed nexushoratio closed 1 year ago

nexushoratio commented 1 year ago

Once all of the libraries are loaded and make it past the call to base.ensure([...]), then the global will be populated by all loaded libraries, not just those requested.

Right now, the recommendation is to do const NH = NexusHoratio;, but what if instead we did something like:

const NH = NexusHoratio.base.ensure([...]);

and NH is a modified copy of the NexusHoratio copy, with only the requested libraries present?

We may have a bit of a bootstrap problem as now that base depends on xunit, so xunit cannot call ensure(). But then again, it should never use either NexusHoratio or NH.