Live data from Hacker News

Show HN: CalDOM: An agnostic, reactive and minimalist JavaScript UI library

caldom.org

31–40 of 60 posts

Re: Show HN: CalDOM: An agnostic, reactive and minimalist JavaScript UI library

#31

Oh damn. I've been working on a project using very similar tricks for the passed ~3 years. I'm assuming state is a proxy and you're using the single threaded nature of JS to make render functions dependent on accessed variables?

Same technique is used for .$ reference holder. Proxies are awesome! :)

Re: Show HN: CalDOM: An agnostic, reactive and minimalist JavaScript UI library

#32
post #23
post #7

For the note: Sciter ( https://sciter.com ) implements CalDOM features out of the box. But better. In Sciter DOM and vDOM are equally honored. This CalDOM's (DOM + vDOM population): _("#output-1") .append( _("+h1").text("Hello World!") ); In Sciter is document.$("#output-1") .append( Hello World! ) And this reactive CalDOM: let app = _().react( {}, { render: state => _( "+h1", `Hello ${state.name}` ) //This is XSS sa…

Did you forget to add that your library has a licensing cost? You don't get access to the source code unless you pay.

Sciter is free if it is used in binary form. Same thing as Google Chrome and MS Edge.

Re: Show HN: CalDOM: An agnostic, reactive and minimalist JavaScript UI library

#33

Interesting I'd still go for Lit ( https://lit.dev/ ) though if you want something light weight and no/little build.

Yeah, Lit is cool & futuristic. However, it's built for ES2019. It requires some effort to make it compatible with previous browsers: https://lit.dev/docs/tools/requirements/

In my opinion, this is the future. Especially, Native Web Components will take over in this decade. CalDOM's long-term plan is to seamlessly merge with native web components when it's widely supported.

Re: Show HN: CalDOM: An agnostic, reactive and minimalist JavaScript UI library

#34
post #25

lately been using Mithril, small api surface but it's been good. I'm enjoying writing JS frontends, again! :) some things can be tricky but the community is helpful. I'm glad others are making tool-less frameworks. just plug it in the script tag and go to work. so props to the author for making something lightweight and straightforward!!

Thank you :)

Re: Show HN: CalDOM: An agnostic, reactive and minimalist JavaScript UI library

#35

Hope this is helpful: the docs at https://caldom.org/docs/ have the table of contents cut off if the window is less than about 1800 px wide. Lots of screens are 1440 or 1280 or even 1024 px wide and won't be able to properly view the documentation. I think it would only take a few simple CSS changes to fix this.

Yeah. Thank you for the valuable feedback. Working on it.

Re: Show HN: CalDOM: An agnostic, reactive and minimalist JavaScript UI library

#36

Earlier quoted context omitted.

Some library like this is going to blow up in popularity eventually. Virtual DOMs are often unnessary abstractions, Svelt introduces it's own whole compilation step, and libs like Vue, Ember, and Angular are just too big. There is clearly a need for a lightweight (on the order of 3kb seems good) "framework" that embraces everything the modern browser lets you do as natively as possible, basically the new jQuery, or m…

You either * write stateful UIs (native, jQuery) * have a Virtual DOM (React, Vue) * use a template language that is JIT or AOT compiled (Angular, Svelte) Those are your choices.

If only there was a reactive handlebar

Re: Show HN: CalDOM: An agnostic, reactive and minimalist JavaScript UI library

#37
post #18

Looks interesting! Kudos on the well documented source, benchmark and website. Are Caldom instances itself always synced with the DOM? e.g. If I create a Caldom instance for all ‘button’ and add an event handler for ‘click’. Now another piece of JavaScript adds a button to the page, will the event handler also trigger for that button or just the buttons when I first instantiated Caldom?

Thank you. Worked really hard on the benchmark :)

No, it's not synced. When you use CalDOM without its reactive features, it's just a wrapper around the native DOM Element (similar to jQuery).

_("button").elem === document.querySelectorAll("button")[0]

Regarding capturing events of future elements: You can achieve this by setting an event listener to the parent.

Eg:

_("body").on("click", e => { if( e.target.matches("button") ) //Do something });

Re: Show HN: CalDOM: An agnostic, reactive and minimalist JavaScript UI library

#38

Earlier quoted context omitted.

You either * write stateful UIs (native, jQuery) * have a Virtual DOM (React, Vue) * use a template language that is JIT or AOT compiled (Angular, Svelte) Those are your choices.

If only there was a reactive handlebar

https://ractive.js.org/ ?

(A predecessor to Svelte)

Re: Show HN: CalDOM: An agnostic, reactive and minimalist JavaScript UI library

#39
post #10

Earlier quoted context omitted.

> But better. This blunt dismissal is very rude when you don’t even mention that you are the author of sciter.

Yep I was thinking the same. Quite an idiot way to advertise your own product. I'll leave that link untouched.

Sciter is really great.

Re: Show HN: CalDOM: An agnostic, reactive and minimalist JavaScript UI library

#40

The aesthetics of a programming language or framework are pretty important IMO, that's one of the reasons Python is my favorit language. This has a lot more punctuation, weird characters (underscore, seriously?), parenthesis and brackets than I ever willing to write or look at. In other words; it's very ugly.

Is your aversion to an underscore more about a variable identified by that or its presence at all?

For the latter Python encourages slug_case_naming_schemes and _ is a valid identifier in Python too. So there's nothing going on here beyond normal Javascript syntax which can be closure heavy -- a main feature of Javascript.

Post reply on HN