Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't pollute the global namespace #4

Closed
OriR opened this issue Dec 11, 2018 · 1 comment
Closed

Don't pollute the global namespace #4

OriR opened this issue Dec 11, 2018 · 1 comment

Comments

@OriR
Copy link

OriR commented Dec 11, 2018

Right now when using $i it puts the result (when finished) on the global namespace - the window.

I'm proposing that instead it returns a promise (due to the async nature of import) that evaluates with the result of executing the desired imported module.

Something like this

$i('lodash').then(_ => _.toNumber(null));

This could also be used with top-level await like this

const _ = await $i('lodash');
_.toNumber(null);

This is gives you the control whether or not you want to pollute the global namespace and how.
Plus, now you don't have to know how the internal module exposes itself ($, _, etc.)

@pd4d10
Copy link
Owner

pd4d10 commented May 4, 2022

Duplicate of #14

@pd4d10 pd4d10 marked this as a duplicate of #14 May 4, 2022
@pd4d10 pd4d10 closed this as completed May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants