Comment

Comment by lelanthran

Thanks to the availability of ChatGPT and Claude, I have actually checked all those links prior to creating my own.

The ZjsComponent thing I use is unlike those things; while the goal of those (and other similar projects) is primarily to perform client-side includes, the goal of zjs-component is to provide client-side object instantiation using a remote object definition.

The paper itself may be a bit arcane and obscure, but as a quick example of what zjs-component was intended to do, see the GH page: https://github.com/lelanthran/ZjsComponent/tree/master?tab=r...

As you'll see from the above link, the goal was not to simply include remote fragments (with some execution behaviour), but to instantiate a local instance of an object defined in a remote file fragment and support instance-scoped code and HTML.

IOW, it's the scoping to a specific instance that is different from the existing `include` or `import` libraries.

It means when you do this (assuming you wrote a counter-obj.zjsc object):

    <zjs-component remote-src='counter-obj.zjsc' start-at='100'> </zjs-component>
    <zjs-component remote-src='counter-obj.zjsc' start-at='200'> </zjs-component>
You will get two independent instances of the counter object, each with their counter variables scoped to their own instance, and each with their HTML scoped to their own instance.
parent lelanthran 1 year ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton