Hacker News new | past | comments | ask | show | jobs | submit login

I don't think that's a sync vs async difference in the API. peek() is related to reading the value without creating a subscription on it: https://preactjs.com/guide/v10/signals#reading-signals-witho...

In general signals looks like a synchronous but lazy system. I don't see anything that's actually async in there?




Not sure how you are getting this conclusion? The example code is as follows:

  effectCount = effectCount.peek() + 1;
That is definitely absolutely clearly 100% for sure sync code. Adding a numerical value +1 to the result of a function (with no wait on it) makes it clear that .peek() here is synchronously returning a value.


Correct, .value does exactly the same thing. The only difference is .value subscribes to updates. The framework is all synchronous (but sometimes lazy).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: