我有一个简单的问题,这几天一直萦绕在我的脑海里:VanillaJS是什么?有人把它称为一个框架,你可以从官方页面下载一个库。
但当我检查一些示例或TodoMVC时,它们只是使用经典的原始JavaScript函数,甚至没有包括官方页面或任何东西的库。此外,官方网页上的“Docs”链接指向JavaScript的Mozilla规范。
我的问题是:VanillaJS是原始JavaScript吗?如果是的话,为什么人们把它称为“框架”,而你所需要的只是一个没有任何特殊脚本的浏览器?
我很抱歉问了一个可能很愚蠢的问题,但我不知道人们说“VanillaJS”时在谈论什么。
There's no difference at all, VanillaJS is just a way to refer to native (non-extended and standards-based) JavaScript. Generally speaking it's a term of contrast when using libraries and frameworks like jQuery and React. Website www.vanilla-js.com lays emphasis on it as a joke, by talking 'bout VanillaJS as though it were a fast, lightweight, and cross-platform framework. That muddies the waters! Thus, it can be a little philosophical question: "how many things do I compile to Vanilla JavaScript without being VanillaJS themselves?" So, a mere guideline for that is: if you can write the code and run it in any current web-browser without additional tools or so called compile steps, it might be VanillaJS.