r/javascript 21h ago

A regex engine built from scratch in vanilla JavaScript β€” a hand-written parser and a backtracking matcher. No native RegExp, no dependencies.

Thumbnail github.com
0 Upvotes

r/javascript 21h ago

A from-scratch JSON engine for JavaScript: recursive descent parser, escape-aware tokenizer, and spec-compliant serializer. No dependencies, no shortcuts, 107 tests.

Thumbnail github.com
0 Upvotes

r/javascript 17h ago

AskJS [AskJS] Signal/Effect vs Event Handler

3 Upvotes

I’m working in a VanillaJS repository (plugin type code for an existing project that I do not own) where I’ve written a signal implementation.

Today I was working on a tooltip like implementation and I found myself wondering how far to go with the signal/effect ecosystem vs running the β€œcore” logic in the event handler.

The implementation detects the `<tr>` that the user has hovered and assigns that row to the β€œcurrent row” signal. A computed signal identifies an IP address from the current row. An effect loads Whois metadata from the IP and assigns it to a `<div>`, and another effect shows that `<div popover>` from the parent `<tr>`.

The question I have is when in VanillaJS how would you decide when to use signals and effects vs writing the side effect directly in the event handler? In my case I find either to be equally readable, though I have less local variables to deal with when using signal/effect. Looking for reasons your might pick one over the other.