Hacker News new | ask | show | jobs
by chrismorgan 1022 days ago
> Is this actually just JavaScript?

JavaScript syntax, yes, but with Svelte semantics rather than JavaScript semantics. Everything else follows from that point. It gets invoked by the Svelte compiler transforming it. In order to work, `count` must have been defined as a property (`let count` or `export let count`), so that the compiler can run that code again when `count` changes. Reactive dependencies are specified purely by mention of their names. (Well, there’s stores too, via the $ prefix on variable names.)

> It might 'just work', but it's also not 'just JavaScript'.

You are completely correct.