Sign in
Log inSign up
Ali Calimli

59 likes

·

496 reads

42 comments

Sai Krishna Prasad Kandula
Sai Krishna Prasad Kandula
Sep 14, 2023

Love the approach, I didn't know about the StorageEvent, so I dived in (maybe to deep).

Looking into it, it seems this is exactly the intended use of the StorageEvent (developer.mozilla.org/en-US/docs/Web/API/Wi..: "it is really a way for other pages on the domain using the storage to sync any changes that are made").

--

A peculiar thing is this only works for the localStorage, even though it should work for both local and session (html.spec.whatwg.org/multipage/indices.html..).

The reason for this seems to be a catch-22, looking at the rules for the event: html.spec.whatwg.org/multipage/webstorage.h..: "Dispatches a storage event on Window objects holding an equivalent Storage object". meaning it only fires on other windows (tabs), and not the instance making the changes.

The sessionStorage has a different instance for each open window (html.spec.whatwg.org/multipage/webstorage.h..: "If the user had multiple windows opened on the site, each one would have its own individual copy of the session storage object.").

So even if the event is fired on the sessionStorage, that exact instance isn't available in any other window, so there's no instance to dispatch to. I have not looked into any actual implementation here, so I don't know exactly what happens behind the curtain.

--

Sorry for hijacking the comments, I just found it funny reading through the specs, and thought maybe others would appreciate the trivia.

Thanks for a great post!

29
·
Ludiville
Ludiville
Sep 20, 2023

Noice

5
·
Zainab Nisa
Zainab Nisa
Apr 25, 2023

nicely explained 💯 :D fdsfdsf fdsfsdf

4
·
·5 replies
Ali Calimli
Ali Calimli
Author
·Apr 25, 2023

Thank you Zainab! :)

7
·
Lakshya Thakur
Lakshya Thakur
Sep 4, 2023

Hey

·
Ludiville
Ludiville
Sep 6, 2023
·
Ludiville
Ludiville
Sep 6, 2023
·
Ludiville
Ludiville
Sep 14, 2023

Amazing

·
Ludiville
Ludiville
Sep 11, 2023

This might work

3
·
Kavir Kaycee
Kavir Kaycee
Sep 8, 2023

Testing a bunch of markdown

An h1 header

Paragraphs are separated by a blank line.

2nd paragraph. Italic, bold, and monospace. Itemized lists look like:

  • this one

  • that one

  • the other one

Note that --- not considering the asterisk --- the actual text content starts at 4-columns in.

Block quotes are written like so.

They can span multiple paragraphs, if you like.

Use 3 dashes for an em-dash. Use 2 dashes for ranges (ex., "it's all in chapters 12--14"). Three dots ... will be converted to an ellipsis. Unicode is supported. ☺

An h2 header

Here's a numbered list:

  1. first item

  2. second item

  3. third item

Note again how the actual text starts at 4 columns in (4 characters from the left side). Here's a code sample:

Let me re-iterate ... for i in 1 .. 10 { do-something(i) }

As you probably guessed, indented 4 spaces. By the way, instead of indenting the block, you can use delimited blocks, if you like:

define foobar() {
    print "Welcome to flavor country!";
}
2
·
·1 reply
Ludiville
Ludiville
Sep 11, 2023

Great stuff

·
Senith Vijayantha
Senith Vijayantha
Apr 25, 2023

Awesome guide Ali! fsdfsdf

·
Sumit Kumar
Sumit Kumar
Apr 26, 2023

Useful

·
·1 reply
Ludiville
Ludiville
Sep 6, 2023

fsdf

·
Bhargav
Bhargav
May 31, 2023

nicely explained

·
Bhargav
Bhargav
May 31, 2023

Commenting here

·
Bhargav
Bhargav
May 31, 2023

Commenting here

·
Bhargav
Bhargav
May 31, 2023

Commenting here

·
Bhargav
Bhargav
May 31, 2023

Commenting here

·
Bhargav
Bhargav
May 31, 2023

Commenting here

·
Lakshya Thakur
Lakshya Thakur
Aug 28, 2023

awesome stufffdsfsdf

heading

google

trust me

truffle

  • jfklsdjflkjsdlfjdslf
  • jflkdsjflkdsjf

  1. fjlkdsjflksdjflsd
  2. jfsdlkjflkdsjflkdsjf
let x= 3434
let y = 324234 
// fjlksdjflksjd fjksdlflk sdjflksjdflkjsd lkfjsdlkjflksdjflkjsdlkfjsdlkfjlksdjflkjsdflkjdslkfjlsdkjflksdjflkjsdlkfjsdlkjflk sdfjsdlkfjlsdkjflksdjflkjsdlf

Image

·
·3 replies
Lakshya Thakur
Lakshya Thakur
Aug 28, 2023

gfdgdfg

·
Lakshya Thakur
Lakshya Thakur
Aug 31, 2023

hola

·
Ludiville
Ludiville
Sep 6, 2023

fsdf

·
Ludiville
Ludiville
Sep 6, 2023

This is good Lakshya Thakur

·
Kavir Kaycee
Kavir Kaycee
Sep 8, 2023
·
·1 reply
Ludiville
Ludiville
Sep 11, 2023
·
Kavir Kaycee
Kavir Kaycee
Sep 8, 2023

Test

·
Ludiville
Ludiville
Sep 11, 2023

This is nice :)

·
·2 replies
Ludiville
Ludiville
Sep 13, 2023

Test Reply

·
Ludiville
Ludiville
Sep 13, 2023

fsdfdsf

·
Sai Krishna Prasad Kandula
Sai Krishna Prasad Kandula
Sep 11, 2023

Yohoooooooo

·
Sai Krishna Prasad Kandula
Sai Krishna Prasad Kandula
Sep 11, 2023

Good One

·
Kavir Kaycee
Kavir Kaycee
Sep 14, 2023

Great!

·
Vamsi Rao
Vamsi Rao
Sep 15, 2023

Hey there

·
Sai Krishna Prasad Kandula
Sai Krishna Prasad Kandula
Sep 15, 2023

interesting one

·
Sai Krishna Prasad Kandula
Sai Krishna Prasad Kandula
Sep 15, 2023

all new comment

·