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

globalThis obviates the need for any shmiming on the user's part. #74

Open
Pomax opened this issue Jul 11, 2021 · 4 comments
Open

globalThis obviates the need for any shmiming on the user's part. #74

Pomax opened this issue Jul 11, 2021 · 4 comments

Comments

@Pomax
Copy link

Pomax commented Jul 11, 2021

ES6 introduced globalThis, which is supported by all LTS versions of Node (support was added in v12, the oldest still available LTS version) and obviates the need for users to write their own shims. The library itself can test whether globalThis.localStorage exists, and if not, create it. As this is the true global scope, localStorage can now be called (without prefix) anywhere, just like require(), process, etc. etc.

@lmaccherone
Copy link
Owner

How do you propose that we allow the specification of the scratch directory that the LocalStorage class needs upon instantiation? Right now, when you shim it in, you get a chance to specify that.

@Pomax
Copy link
Author

Pomax commented Nov 25, 2021

Have a sensible default (e..g. node_modules/node-localstorage/scratch/) and tell people that if they need a different dir, they will need to explicitly shim?

@trasherdk
Copy link

I think pretty much any OS has functions for create temp directories and files.

@lmaccherone
Copy link
Owner

Is anyone still interested in this change. Seems pretty easy and reasonable?

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

3 participants