Hacker News new | ask | show | jobs
by zambal 1114 days ago
So loading an external library or framework isn't Vanilla JS, but if I copy/paste the VanJS source into a script tag, nothing gets loaded, there's no syntax magic, just some function calls, so that's Vanilla JS, right? If the latter isn't Vanilla JS by your definition, can I at least copy/paste something from stackoverflow?

Trying to make Vanilla JS a strict definition seems pointless to me in the first place.

3 comments

> so that's Vanilla JS, right

I think we don't have to argue about the distinction between the library code and the application code. It doesn't matter how the library is loaded. You can get it from a CDN at runtime, load it from a scriptbundle, copypaste it into a <script> tag, it doesn't matter.

It's still library code that the rest of the application depends on. As soon as that is the case, it's no longer what the JS community by and large calls "Vanilla JS".

This is Vanilla JS:

    fetch('/readme.txt')
    .then(response => response.text())
    .then(data => console.log(data))
    .catch(error => console.log(error))
This isn't:

    awesomeLib().goesBrrrrr()
> Trying to make Vanilla JS a strict definition seems pointless to me in the first place.

Being able to name things, and having clarity in a community about what names denote, is anything but pointless.

When you do it this way isn't even a framework is just a helper library (at his best). There is another concept for this kind of micro-libraries but calling "framework" to something that will not establish a frame of work for you.
The important part is that if you don't copy VanJS into a script tag, or use it all, you're still doing Vanilla JS.