3 ms·
Thanks for the comment! These 2 other libraries are really great. For something as important as the choice of a web framework, I realized I really wanted to 1
by josephernest 3y ago
Thanks for the comment!
These 2 other libraries are really great.
For something as important as the choice of a web framework, I realized I really wanted to 100% understand the internals, then I starting working on Swap.
The key things for me are:
- no tool required (just a text editor, no compiler, no bundler/packer, no minification even needed: I just wanted to write JS and that's all).
- be able to re-read the source code in 10 minutes and 100% understand how it works, which is impossible with most frameworks
- even if simple, I wanted that non-trivial features are included (such as browser history, when using previous / forward browser buttons), because I don't want to have to think about this when creating a new web appliation
My first prototypes took a few hundreds of lines of code (for the same result). I spent some good time redesigning it, and finally I was surprised I can cover 80% of my navigation needs (when doing web applications), with only 50 to 100 LoC.
For the rest (features not enhanced by Swap, like form submission), of course, I just write normal JS, but I think I would have done it anyway whatever the framework.
TL;DR: in my lib I just focused on swapping HTML content (parts of the page) when navigating, thus the name "Swap" :) + I wanted the lib to do the boring stuff for me (make sure the browser history still works, etc.)