-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Web API: window.localStorage #5052
Conversation
Implements window.sessionStorage in-memory only. Refs: https://html.spec.whatwg.org/multipage/webstorage.html#storage-2
Implements window.localStorage using sled. Work in progress.
f71af62
to
1b124b2
Compare
export const windowGlobalScopeProperties = { | ||
localStorage: getterOnly(() => { | ||
// @ts-ignore | ||
const { origin } = location; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
location
was removed: https://github.com/denoland/deno/releases/tag/v1.0.0-rc1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'd say there's no way to land anything localStorage
related without reintroducing globalThis.location
and first deciding what it means.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for opening the PR and the effort @aduh95, however similarly to #4973 before introducing storages that depend on origin we need to figure out a Web compatible way for deciding on location
.
It'd be better to first spec out such complex feature in a design doc and get some consensus before implementing it (especially if it pulls new Rust crates).
Closing without merge.
@@ -50,6 +50,7 @@ rustyline = "6.1.0" | |||
serde = { version = "1.0.106", features = ["derive"] } | |||
serde_derive = "1.0.106" | |||
serde_json = { version = "1.0.51", features = [ "preserve_order" ] } | |||
sled = "0.31.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sled
is still considered unstable
Implementation of
window.localStorage
on top of #4973 using the sled crates. Please ignore thesessionStorage
implementation, this PR focuses on commit b3c225f.This should not land as is, I built it as a proof of concept of what a
localStorage
implementation for Deno could look like. We would need to discuss about:$CWD/$ORIGIN
...).Regarding the implementation, I tried to stick to the HTML specs and failed:
localStorage.clear
should be atomic, the sled method I use is not.localStorage.key
is not implemented.Blocked by #4973