Hacker Newsnew | past | comments | ask | show | jobs | submit | AltruisticGapHN's commentslogin

I created a similar `$()` utility function for my projects albeit with 10 times less functionality.

I used the same basic signature for the `$()` function. However I found that 95% of the time I don't need to use the chain method on a collection. There's almost no scenario in which I want to do <collection>.addClass() etc. There's practically ZERO situations in which I would use something like attach an event to a collection of nodes, since event delegation is more elegant (attach a single event and check for event.type and event.target).

So TLDR I made $() always select a single element with `querySelector()`, which means I could remove the collection/loop from every chained method like addClass() or css() or toggle().

Point unless you write bad code to begin with, you can probably make this significantly smaller by removing the collection handling. The 1% of the time it is warranted to do an addClass() or something else on a bunch of nodes you can just go native and if the collection is small enough just call $() on each element.

PS: I guess the subtext also to my post is sometimes something looks logically elegant, like the ability for any chained method to act on the collection selected by $(), but it may not make any sense in the real world.


There's really cool / chill experiences on PCVR like a kayak game, but I can't spend money on a PCVR only headset. I have a Quest 3 and it's such a hassle to set up Oculus Link on top of the PC running - that I end up playing Quest games only.

Which is where I am a bit mystified by the article's claim of "hyper realistic" games. Even on PCVR the quality of PC VR games in general is quite low. We're a far cry from hyper realistic experiences. Typically either the graphics suffer and you have smooth FPS or the graphics are great and you have bad FPS, or you are a rich person that owns an RTX 4090 etc.

For me it's only a matter of a few more years. Most games on Quest atm to me look like cheap mobile games. I hate those low poly / untextured styled games with a passion.

The author perhaps does not understand that to make truly immersive, relaxing experiences in VR you need a LOT more power. There 's nothing very relaxing about being in a forest made of low poly trees, shitty looking water and distant scenery that looks blurry AF.

Even on YouTube at the best quality I can find, there is hardly anything truly relaxing or immersive. Take a random video of the Grand Canyon in VR and everything in the distance is just flat.

Colours is also a huge problem. Watch a VR video of someone walking on the beach : the sky is blue yes but a weird half light blue that is nowhere near anything like the kind of brightness of the real sky. It's all deadened and flat.

The technology just isn't there. So right now, violent, in your face action is where VR shines. Typically anything that moves, and anything that comes close to the camera gives a much better sense of immersion. I find myself often times almost putting my nose to everything because it's when things are up close that you get that sense of 3D the most. Anything taht is even a couple meters away becomes flat and featureless.

Anyway I could just rant on and on. VR is great. The kind of games that currently do well on it do so for a reason. I'd love to just travel in VR, to be immersed on some remote island, basking in the sun, or to listen to the crickets and watch the starry sky.. all those things currently are awful experiences in VR due to the technical limitations.


I'm having fun using lit-html with vanillajs, after I saw a tweet from Marc Grabanski suggesting he didn't use the full Lit library. Admittedly I am then not taking advantage of all the reactivity goodness, but I also really dislike the decorators syntax and 95% of the time I just don't need the reactivity after the first render.

It works great! I was amazed at how you can do so much in templates, it's pretty much everything I could do in Vue templates, though a little more verbose.

I built my own `VanillaComponent` class, which has a mount() method which calls the render() function which I define on the child class.

My VanillaComponent class looks like this:

    import { html, render } from "lit-html";
    
    abstract class VanillaComponent {
      abstract render(): ReturnType<typeof html>;
    
      private _mountPoint?: HTMLElement;
    
      mount(this: VanillaComponent, target: HTMLElement) {
        target.textContent = '';
        this._mountPoint = target;
        this._update();
      }
    
      _update() {
        let templateResult = this.render();
        let rootPart = render(templateResult, this._mountPoint!);
      }
    }

So I can write something like

    class MyComponent extends VanillaComponent {
      constructor(props: { label: string }) {
        this._props = props;
      }
      
      render() {
        return html`<button>${this._props.foo}</button>`;
      }
    }
Then I can instance like so:

    let myComponent = new MyComponent({ label: "I am a button" });
    let target = document.querySelector("#demo");
    myComponent.mount(target);

The base class stores the root node (target), so later I can do

    myComponent.update()
to re-render, taking advantage of lit-html's "diffing" logic.

However something I have not been able to solve with lit-html only, is when I compose parent and child components I have to do something like :

    class MyDialog extends VanillaComponent {
      render() {
        let childComponent ...  // another VanillaComponent previously instanced
        return html`
          <div>
            ${childComponent.render()}
          </div>

So the child component I need to explicitly call render() to get the TemplateResult for the parent template.

But this means I can not do `childComponent.update()` because I don't know the root element of child component, since I did not mount it explicitly myself.

I mean technically because of the lit-html optimizations, I can do `.update()` on myDialog (the parent component) after any child component's props changes, and it will only re-render what is necessary... but let's say my child component has like 1000 cards... it seems very wasteful and it would be ideal if I could re-render only the child.

I wonder if there is a trick to get around that with just lit-html?


It's always worth checking the lit built in directives list for the one you've still missed (or at least it is for me ;).

I think in this case the ref() directive - i.e. https://lit.dev/docs/templates/directives/#ref - may be what you want. If it isn't exactly, reading how it's implemented would be my first step towards building something similar that is.


Thanks I created a custom directive, it's just ten lines of code and it works beautifully. Simply grabbed the `part.parentNode` property. I did the same for a `transition` directive that does something similar to using `appear` in Vue transition to have a nice fade in on first load.


Have you looked into lit-html?

Coming from Vue I was really surprised it does a lot of what Vue templating does, including attaching events, with just vanilla JS templates. And when you use VSCode lit extension, you get syntax highlighting and full type checking inside the templates.

I learned about lit-html after a tweet from Marc Grabanski, where he said he used lit-html with vanillajs, not Lit.

After some experimenting I found it works great and it seems like you are trying to solve something very similar.

When you use the lit-html template package you can do basically evetything that is described in the Templates chapter

https://lit.dev/docs/templates/overview/

... without all the other abstraction of components that are part of lit-element.

https://lit.dev/docs/libraries/standalone-templates/#renderi...


If you replace "WALL" "IS" "STOP" with icons/images, it's not that interesting anymore imho.

At the very least, Captain Blood would come to mind.

https://www.abandonware-france.org/ltf_abandon/ltf_galeries....

You have sequences of symbols, with attached mechanics. Arrange the blocks in different order, to get different outcomes.

Maybe I'm just grumpy today, I don't see how the game is "profound".

edit: I guess what I have in mind is if anything, the fact we can create meaning out of any collection of symbols, and decide waht it means, shows that language is really empty and intelligence is completely outside of language. Language is just a tool.


I'm not sure what you mean. How would you replace the words with icons and still have the exact same mechanics, and how would having the exact same mechanics be different if it were icons instead of words?


Bah I wouldn't be surprised it is actually safer today. Problem is today there are far, far more rules and regulations.


A damn shame such a cool article has no photos.




Exactly. I really wanted to see what a bus with sleepers for everyone, a full kitchen and restrooms looked like. It couldn’t possibly have fit that many passengers.

Edit: I found pictures. It was a double decker.


And I think the point is they will then be able to support DXVK to run Direct3D games.


I don't get it. They already make a ton of money on mobile games - why not embrace Steam and Proton on their platform? What's the money in AAA games on their platform?

edit: this is to say if they had "wet dreams" about selling AAA games on Mac, we'd have seen the tides moving a long time ago.


Buying from Steam doesn't give them the appstore cut. And nobody buys Macs for gaming, so it doesn't drive hardware sales either.


What I don't get is that games compete in the attention market and are a big money industry next to movies and TV.

Apple is happy to produce its own movies and tv shows but not AAA games?

Or maybe they have and I simply didn't see that blip, I am honestly not in sync with Apple gaming world.


Apple wants to own the entire computing stack for the average Joe, for legitimate integration reasons and illegitimate monopolistic market capture reasons.


Pretty much, Asahi Linux could become the new Bootcamp for Mac users who dual booted to play games.

FWIW I played Diablo II Resurrected on a M1 with "Whiskey". I was quite impressed that I was able to play a native Windows game just like that. It doesn't work anymore just because a stupid Blizzard launcher update now crashes and prevents starting the game.

I also ran EverQuest II admittedly an old DX9 game but still the game ran beautifully on a M1 mac mini at 1440p.

Linux Asahi may help also with older x32 titles like Guild Wars.


I've been playing Diablo 4 and Diablo II Resurrected on Crossover ever since Whisky didn't work with Battle.net anymore. It's been working great tbh!


Just buy Crossover, then Diablo runs fine on MacOS again!


Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: