4 ms·
xstate is a nice javascript library which even generates charts out of your defined states in your app: https://github.com/davidkpiano/xstate https://github.com
by topaxi 9y ago
xstate is a nice javascript library which even generates charts out of your defined states in your app: https://github.com/davidkpiano/xstate https://github.com/davidkpiano/xstate
- restore24 9y agoSimilarly, I have a early-stage JS library for hierarchical statecharts. It revolves around nested contexts and an explicit message passing interface for controlling states between parent/child/sibling. Example: https://github.com/jdque/royal/blob/master/test.js https://github.com/jdque/royal/blob/master/test.js
- mpfundstein 9y agooff-topic but why do you use 'let' instead of 'const'? In royal.ts you do that all the time even though you variables don't change! Is there a reason for that?
- braythwayt 9y agoI have no idea why they did it, but I have argued for quite some time that const has very little practical value, because its effect is always lexical and local. To demonstrate that this is so, I suggest that we can write a processor that converts all lets to consts where possible. I also demonstrate that this is so by asking, "What bug will const catch that our tests will not catch?" _Immutable Data_, on the other hand, is marvellous. Immutability has nonlocal effects, and it is not something that can be trivially verified.
- mpfundstein 9y agoI agree with your assessment, but for me it is a message from the programmer to the reader. Hey this value will not be re-assigned during the following scope block. If I see a let, I know I must be careful. Of course this doesn't apply to properties of objects ... which is a pity!
- davidkpiano 9y agoThanks! I have some awesome updates to announce very soon!