108 karma · joined Jul 20, 2022 (4y ago) · 27 submissions
1.
Flyweight: A Node.js ORM Specifically for SQLite(github.com ↗)
94 points · by unemployable · 2y ago · 43 comments
comment 2y ago · link · parent
For other event listeners, they get removed when the DOM element is removed.
The frameworks do not solve this to any greater degree. They also just make everything invisible and behind-the-scenes and hard to debug due to their declarative nature, but that is another topic.
comment 2y ago · link · parent
In this example, the event is on the Window. There is no bubbling. It is already at the top level.
>Believe me, you don’t want to use the standard event handling API without a framework. Adding, deleting, cloning, firing, removing, fire once etc on many elements can have serious unwanted side effects.
I don't know what this means. The frameworks do not have much to do with this topic.
4.
Show HN: Quietone – search audio and video by transcript(andrewitsover.com ↗)
1 points · by unemployable · 2y ago · discuss
comment 3y ago · link · parent
I have inherited code written by teams and it was not good quality. I just rewrote each section when I needed to change something. This seems like a much better approach then trying to write maintainable code - write code that can be thrown out and rewritten.
7.
Comparing React to VanillaJS(itsover.au ↗)
2 points · by unemployable · 3y ago · 1 comment
comment 4y ago · link · parent
comment 4y ago · link · parent
Projects using Artwork can be run without any transpiling or compiling thanks to import maps and CSS imports.
I am very happy with it. Maybe it is not for you, but I like it.
10.
Artwork – a simple front-end framework with no HTML(github.com ↗)
1 points · by unemployable · 4y ago · 4 comments
comment 4y ago · link · parent
I don't think so. For example, pgsql had an array type before it got JSON, so the drivers can't automatically convert arrays that you want to insert into JSON. With my SQLite ORM, you can just insert arrays and objects and it knows to convert them automatically to JSON.
I like that SQLite just has a few primitive types. My ORM will be able to build on top of them. For example, JavaScript will soon be adding new date types (Temporal), and I will create new types for that, which will be stored as text ultimately.
comment 4y ago · link · parent
The other tools I have seen that try to figure out SQL types do not accurately create types for things like left joins.
comment 4y ago · link · parent
That is the point of Flyweight. The API is very small, and for everything else you use SQL. The ORM parses the SQL to figure out the types, and when you want it to, it maps the SQL into more complex data structures.
19.
Flyweight: An ORM for SQLite(github.com ↗)
90 points · by unemployable · 4y ago · 103 comments
comment 4y ago · link · parent
The comments in this thread say that the way you are writing TypeScript is wrong. What they are advocating for is essentially turning TypeScript into Java in terms of its style. This is what good TypeScript codebases end up looking like. They don't look like JavaScript. You could take all of the type information out and they still wouldn't look like JavaScript.
I think that when people find that their ex-JavaScript, now TypeScript codebases have become Java codebases, many of them will realise they don't really like TypeScript anymore. If they are the people that said "You aren't professional if you don't use TypeScript", etc, then they are not welcome back into the JavaScript cult. If they are not one of those people, they must profess their hatred of TypeScript, and then we will let them back in.
Anyway, no matter what, you still have to work with the native APIs and so on, which just don't work with TypeScript. Take Web Components for example. You create a web component by defining a class, but you never instantiate the class yourself. You use document.createElement('my-component'). Good luck typing that. Good luck typing proxies.
I hate TypeScript.
comment 4y ago · link · parent
comment 4y ago · link · parent
These days I use a deleted table as per the article as I decided it would be better to deal with the more complex undelete process. It keeps that process to a single section instead of spreading it all throughout your database.
Some of the suggestions here like "use views" don't really work for two reasons - sometimes the is_deleted check must be performed in the ON clause, not in the WHERE clause, and sometimes you want to count the deleted or show the deleted, while other times you don't.