Logic gate simulation based on Node EventEmitters.
While logic gates can be implemented as pure functions (see Logic Gates in JavaScript and https://github.com/ahuth/bit-adder), they can't easily model circuits that require a delay.
For example, an oscsillator generally requires a feedback loop, and therefore a delay, for it to work. This project is an exploration of APIs that better support such circuits. By basing the simulation on events emitters, we can easily introduce slight a slight delay between the time a logic gate receives a signal, and the time the output signal is sent.
Working through this reminded me of the A Simulator for Digital Circuits exercise in Structure and Interpretation of Computer Programs.
Tests can be ran with the following command:
yarn test