TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Mini projects built with VanillaJS. No frameworks or libraries

417 点作者 jonifico超过 5 年前

38 条评论

baxuz超过 5 年前
Here&#x27;s one I did as an assignment for a job interview: <a href="https:&#x2F;&#x2F;github.com&#x2F;ivancuric&#x2F;hn-scroll" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;ivancuric&#x2F;hn-scroll</a><p>You can see it in action here: <a href="https:&#x2F;&#x2F;hn-scroll.netlify.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;hn-scroll.netlify.com&#x2F;</a><p>The task was to build an offline capable site which displayed the latest Hacker News posts, and loaded more lazily when scrolling. I had to use the official HN API, and I couldn&#x27;t have any middleware or caching. Everything had to be done client-side.<p>The app ended up being 1.4kb in total, with support for practically streaming in the items, batching them by network response times and render frames, while keeping the order.<p>You can see the batched items in this version: <a href="https:&#x2F;&#x2F;codesandbox.io&#x2F;s&#x2F;hardcore-stonebraker-8m8fx" rel="nofollow">https:&#x2F;&#x2F;codesandbox.io&#x2F;s&#x2F;hardcore-stonebraker-8m8fx</a>
评论 #22238042 未加载
评论 #22235309 未加载
评论 #22233942 未加载
评论 #22234256 未加载
评论 #22234770 未加载
评论 #22235064 未加载
评论 #22234328 未加载
评论 #22234577 未加载
评论 #22238964 未加载
errantspark超过 5 年前
I&#x27;m so glad to see this and projects like this getting attention. I&#x27;m responsible for several tools at my current job using nothing but straight JS, including a couple which have had a significant (positive) impact on the special projects team here.<p>I love JS. I love it&#x27;s ubiquity (F12 in any browser and you&#x27;ve got a REPL). I love the freedom I have when I write in it to do whatever the fuck I want and shoot myself in the foot in all sorts of strange ways. It&#x27;s a very expressive language that lends itself to all sorts of fun. I love being able to inline C functions as WASM. I love manually managing memory with typed arrays. I love the filth of it all. It&#x27;s liberating to give up all your dignity and just fling mud with a big grin on your face because your ridiculous 5 lines are a functional standin for a templating engine.<p><pre><code> let applyTemplate = template =&gt; object =&gt; { let keys = Object.keys(object) return new Function(&#x27;input&#x27; , `let {${keys.join(&#x27;,&#x27;)}} = input return \`${template}\``)(object) }</code></pre>
评论 #22233680 未加载
评论 #22236370 未加载
评论 #22236268 未加载
评论 #22233592 未加载
评论 #22234253 未加载
adrianh超过 5 年前
Soundslice (<a href="https:&#x2F;&#x2F;www.soundslice.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.soundslice.com&#x2F;</a>) — a website built around interactive&#x2F;responsive sheet music, rendering the music entirely in client-side JS — doesn&#x27;t use JavaScript frameworks or libraries.<p>I&#x27;m the developer of Soundslice and continue to be happy with the vanilla JS decision, 8+ years into the company. It means better performance, clearer code, smaller JS filesizes.<p>I gave a talk about it here: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=VvOsegaN9Wk" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=VvOsegaN9Wk</a> (&quot;A framework author&#x27;s case against frameworks&quot;) and here: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=XH5EtQge_Bg" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=XH5EtQge_Bg</a> (&quot;How I optimized my JavaScript sheetmusic rendering engine&quot;)
评论 #22234182 未加载
评论 #22235039 未加载
Ndymium超过 5 年前
Lately I&#x27;ve really enjoyed writing small apps in vanilla TypeScript. Since the TS compiler generates JavaScript that works in modern browsers and those also support the module syntax natively, you can get away without using NPM and a bundler like Webpack at all. Of course this starts to fall down when you get over a certain size but it works well and is quick to get going with for simple things like this lunch menu I built: <a href="https:&#x2F;&#x2F;gitlab.com&#x2F;Nicd&#x2F;sodexo-menu" rel="nofollow">https:&#x2F;&#x2F;gitlab.com&#x2F;Nicd&#x2F;sodexo-menu</a><p>The only gripe I have there is that you need to write imports with a JS extension as the TS compiler won&#x27;t change them. So to import `foo.ts`, you need to write `&quot;.&#x2F;foo.js&quot;`. The compiler understands it and it also allows the browser to understand it too.
评论 #22233434 未加载
antonios超过 5 年前
It&#x27;s interesting that vanilla JS feels like a breath of fresh air nowadays. I guess the JS cycle is now complete (?)
评论 #22232931 未加载
评论 #22232944 未加载
评论 #22232989 未加载
评论 #22233087 未加载
评论 #22236421 未加载
jasonkester超过 5 年前
There’s no need for these projects to be “mini”. Javascript and html is a good choice for big things too. It’s still my go to “frontend stack” for lots of stuff today.<p>Here’s a pretty big “VanillaJS” project I built back in 2006, back when we called these things web apps:<p><a href="https:&#x2F;&#x2F;www.twiddla.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.twiddla.com&#x2F;</a>
评论 #22233397 未加载
hilti超过 5 年前
I love these type of showcases. It‘s been a wonderful time when simply upload files via SFTP and had a running application. No need of webpack bundles, vendor libraries to achieve a simple functionality that could be solved in a few lines of code ...<p>I really do hope this kind of developer attitude (writing pure VanillaJS) is coming back.
评论 #22233037 未加载
评论 #22233017 未加载
评论 #22235428 未加载
评论 #22240565 未加载
评论 #22236127 未加载
评论 #22239109 未加载
rikroots超过 5 年前
Some Javascript frameworks I like; some I tolerate. Some (&lt;cough&gt;angular&lt;&#x2F;cough&gt;) I learned to despise.<p>I reserve my love only for VanillaJS.<p>My library for playing with the canvas element[1] is entirely VanillaJS. 0% dependencies. 1000% a learning experience for me, having to seek into the darkest corners of the language to find solutions to problems I didn&#x27;t even know existed!<p>[1] Scrawl-canvas - <a href="https:&#x2F;&#x2F;github.com&#x2F;KaliedaRik&#x2F;Scrawl-canvas&#x2F;tree&#x2F;v8-alpha" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;KaliedaRik&#x2F;Scrawl-canvas&#x2F;tree&#x2F;v8-alpha</a>
评论 #22235615 未加载
wffurr超过 5 年前
I wish more NPM modules were vanilla JS; then it wouldn&#x27;t be quite so hellish to audit your dependencies or vendor them.<p>I needed a lib to measure text for layout recently, and ran across <a href="https:&#x2F;&#x2F;github.com&#x2F;soulwire&#x2F;FontMetrics" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;soulwire&#x2F;FontMetrics</a> which is nice and clean and completely self contained. It&#x27;s a perfect library.
评论 #22237594 未加载
bitL超过 5 年前
Isn&#x27;t the whole draw.io written in VanillaJS as well? That looks like a massive project:<p><a href="https:&#x2F;&#x2F;old.reddit.com&#x2F;r&#x2F;javascript&#x2F;comments&#x2F;9p826q&#x2F;how_drawio_is_made&#x2F;e806uf3&#x2F;" rel="nofollow">https:&#x2F;&#x2F;old.reddit.com&#x2F;r&#x2F;javascript&#x2F;comments&#x2F;9p826q&#x2F;how_draw...</a>
dep_b超过 5 年前
I did a project around 2018 if I remember correctly where I did all of the code in inlined vanilla JS. It was simply firing off timed API calls for a pop quiz but it was resilient up to the point where a page reload would simply continue where the last question left off. Maybe 300 lines of code, max. Literally anybody that had to work on it kept asking why I didn&#x27;t at least use jQuery or another flavor of the month framework.<p>&quot;Can you point out in this code where using a framework is necessary?&quot;<p>Never got an answer to that, still people were so <i>nervous</i> about the lack of JS frameworks.
abraxas超过 5 年前
Interesting. As a developer who&#x27;s done no front end work since the nineties and has had little appetite for getting back into it (after having seen what modern front end devs seem to contend with) I surmise that all those crap.js frameworks of the month don&#x27;t do a whole lot of useful stuf after all.<p>I suspected as much but was always too timid to speak up when I observed how much noise and fury in the office produced so little UI.
评论 #22233209 未加载
评论 #22233377 未加载
tlbsofware超过 5 年前
When I was working for the USGS I was tasked with making a stream tracer to help the national park service fight oil spills at mammoth cave. However I wasn’t allowed to write any server code due to security issues so I wrote the whole algorithm in javascript. It would take about 1 min to parse all the geojson streams into what what I called a node array which contained all the nodes containing the info of where streams connect and which stream they either flow downwards or upwards into. I eventually learned how to use node.js to allow me to run the node processor on the computer and then to just load the output files into the algorithm to allow the website to bypass this processing. I made a big push to try and open source my algorithm (minus all the confidential data the project had), however the website doesn’t have all the fancy controls that I created for the real project as I was hired by another company fairly quickly once I started applying around with this and a d3.js choropleth under my belt as my 2 first professional projects.<p>Tlbsoftware.github.io&#x2F;StreamTracer.html<p>GitHub.com&#x2F;tlbsoftware&#x2F;streamtracer
EGreg超过 5 年前
We built a lot of things with Vanilla JS. You can find them all here:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;Qbix&#x2F;Platform&#x2F;blob&#x2F;master&#x2F;platform&#x2F;plugins&#x2F;Q&#x2F;web&#x2F;js&#x2F;Q.js" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Qbix&#x2F;Platform&#x2F;blob&#x2F;master&#x2F;platform&#x2F;plugin...</a><p>And the documentation:<p><a href="https:&#x2F;&#x2F;qbix.com&#x2F;platform&#x2F;guide&#x2F;javascript" rel="nofollow">https:&#x2F;&#x2F;qbix.com&#x2F;platform&#x2F;guide&#x2F;javascript</a><p>It&#x27;s open source so feel free to rip the code from there, or just use the full Q.js !<p>For loading code, a long time ago we just implemented two methods:<p><pre><code> Q.exports(a, b, c) Q.require(src, callback) </code></pre> Following node but just async. It’s simple and it works. We were able to know the name of the latest loaded js file in exports() by a trick of throwing an exception and catching it to see what script was on the top of the stack. All browsers seem to support this.<p>Since it worked back then, we didn’t need anything else. It is super simple to just keep using those things and replace the middleware underneath to whatever is the standard du jour.<p>It&#x27;s super short and simple, you can implement similar things in your projects:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;Qbix&#x2F;Platform&#x2F;blob&#x2F;master&#x2F;platform&#x2F;plugins&#x2F;Q&#x2F;web&#x2F;js&#x2F;Q.js#L7842" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Qbix&#x2F;Platform&#x2F;blob&#x2F;master&#x2F;platform&#x2F;plugin...</a><p><a href="https:&#x2F;&#x2F;github.com&#x2F;Qbix&#x2F;Platform&#x2F;blob&#x2F;master&#x2F;platform&#x2F;plugins&#x2F;Q&#x2F;web&#x2F;js&#x2F;Q.js#L7826" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Qbix&#x2F;Platform&#x2F;blob&#x2F;master&#x2F;platform&#x2F;plugin...</a>
thrownaway954超过 5 年前
so happy to see brad and traversy media get some attention on hacker news. been watching his youtube channel for a long time and learned so much from him.<p><a href="https:&#x2F;&#x2F;traversymedia.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;traversymedia.com&#x2F;</a>
评论 #22234811 未加载
naikus超过 5 年前
Cool! I&#x27;ve build a couple of vanilla js projects, a widget and a framework.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;naikus&#x2F;svg-gauge" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;naikus&#x2F;svg-gauge</a> This one is all in one widget completely in vanilla js. Zero deps. An interesting thing is there is an angular-js wrapper that someone else built on top of this.<p>This one is actually a view lifecycle management framework for simple SPAs and mobile web apps <a href="https:&#x2F;&#x2F;naikus.github.io&#x2F;stage&#x2F;" rel="nofollow">https:&#x2F;&#x2F;naikus.github.io&#x2F;stage&#x2F;</a> (This site is actually built using the stage)
评论 #22234351 未加载
IMTDb超过 5 年前
Quick &#x2F; dumb question : in the breakout game example (<a href="https:&#x2F;&#x2F;github.com&#x2F;bradtraversy&#x2F;vanillawebprojects&#x2F;blob&#x2F;master&#x2F;breakout-game&#x2F;script.js" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;bradtraversy&#x2F;vanillawebprojects&#x2F;blob&#x2F;mast...</a>) wouldn&#x27;t the game feel fast&#x2F;slow depending on the power of your computer since the physics loop does not make use of the elapsed time between updates ?
评论 #22233925 未加载
评论 #22233911 未加载
rishav_sharan超过 5 年前
Great to see Vanillajs get more attention. I also wrote an article on this topic a while ago; using VanillaJS to create a basic spa<p><a href="https:&#x2F;&#x2F;dev.to&#x2F;rishavs&#x2F;making-a-single-page-app-in-ye-good-olde-js-es6-3eng" rel="nofollow">https:&#x2F;&#x2F;dev.to&#x2F;rishavs&#x2F;making-a-single-page-app-in-ye-good-o...</a>
cryptozeus超过 5 年前
This is good for practice and learning but honestly what is the point of going backwards. Some of these demos don’t even work on safari in mobile. Frameworks are there for a reason. If one must learn in plain ja then sure go for it but no point knocking down frameworka
评论 #22233481 未加载
fergie超过 5 年前
Its striking how clean a lot of the js code is for these projects. They do so much with so little
评论 #22238420 未加载
allenu超过 5 年前
I normally do iOS development and have been building a few fun sites in the last few years and because I&#x27;m not familiar with web front-end frameworks and tooling, all the stuff I&#x27;ve done[1] is done in vanilla javascript. I&#x27;ve found it pretty easy to build things just using it alone, although my apps are just mini projects.<p>[1] See <a href="https:&#x2F;&#x2F;www.ussherpress.com&#x2F;synthiejs&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.ussherpress.com&#x2F;synthiejs&#x2F;</a> for a simple synth player using web audio or my request-a-drawing site <a href="https:&#x2F;&#x2F;www.drommysommy.com" rel="nofollow">https:&#x2F;&#x2F;www.drommysommy.com</a>
Aperocky超过 5 年前
A ‘mini’ simulation that I have in pure JavaScript:<p><a href="http:&#x2F;&#x2F;aperocky.com&#x2F;prehistoric" rel="nofollow">http:&#x2F;&#x2F;aperocky.com&#x2F;prehistoric</a><p>(Mobile not fully supported)<p>Did use Pixi for sprites and display, but that’s kind of unavoidable.
evolveyourmind超过 5 年前
Here is my 120 lines vanillajs neuroevolution flappy bird <a href="https:&#x2F;&#x2F;evolveyourmind.github.io&#x2F;flappyai&#x2F;" rel="nofollow">https:&#x2F;&#x2F;evolveyourmind.github.io&#x2F;flappyai&#x2F;</a>
jypepin超过 5 年前
A few years ago my work environment became so complex that I felt like I was spending more time trying to code, than actually coding. So I started that thing where on Sunday mornings, I would give myself a couple hours, in bed, to code something simple in vanilla js.<p>It was super fun, and here&#x27;s the result: <a href="http:&#x2F;&#x2F;jypepin.com&#x2F;lolz" rel="nofollow">http:&#x2F;&#x2F;jypepin.com&#x2F;lolz</a><p>A few of those were harder than others and forced me to re-learn some basic maths. I really recommend doing such a thing sometimes!
carlmungz超过 5 年前
I love seeing vanilla JS projects getting some love. I started one last year (<a href="https:&#x2F;&#x2F;github.com&#x2F;CarlMungazi&#x2F;aprender-js" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;CarlMungazi&#x2F;aprender-js</a>) and I feel it has made me a better programmer.<p>If anyone wants to learn more vanilla JS stuff, you should check out <a href="https:&#x2F;&#x2F;gomakethings.com" rel="nofollow">https:&#x2F;&#x2F;gomakethings.com</a> by Chris Ferdinandi.
limaho超过 5 年前
Here’s a simple game I wrote in vanilla js (client side) two summers ago<p><a href="https:&#x2F;&#x2F;www.mouse-movement.liammahoney.dev" rel="nofollow">https:&#x2F;&#x2F;www.mouse-movement.liammahoney.dev</a><p>Heads up it doesn’t work on mobile. Also there some bugs at the end of the game I never got around to ironing out.<p>Code: <a href="https:&#x2F;&#x2F;github.com&#x2F;LiamMahoney&#x2F;mouse-movement" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;LiamMahoney&#x2F;mouse-movement</a>
sstangl超过 5 年前
Here&#x27;s a simple no-framework points calculator for the sport of Powerlifting: <a href="https:&#x2F;&#x2F;www.ipfpointscalculator.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.ipfpointscalculator.com&#x2F;</a><p>The page is 11KB, loads in 96ms, and makes three requests to one network, two of which are favicon-related.<p>This turns out to actually matter in practice because many of our users are from countries with extremely slow connections.
评论 #22240996 未加载
maggit超过 5 年前
I have recently experimented with writing dependency-free JS. I ended up using Webpack and Babel, but no frameworks or libraries, and I find it quite nice to work with. These are my tips for making the best of it: <a href="https:&#x2F;&#x2F;magnushoff.com&#x2F;blog&#x2F;dependency-free-javascript&#x2F;" rel="nofollow">https:&#x2F;&#x2F;magnushoff.com&#x2F;blog&#x2F;dependency-free-javascript&#x2F;</a>
tomaspollak超过 5 年前
I&#x27;m not sure if this qualifies as &quot;mini&quot;, but mi chiptune&#x2F;MIDI player [1] was written without the use of any big frameworks, even though it relies <i>heavily</i> on Javascript, both for navigation, visuals, and of course audio synthesis (via Emscripten).<p>[1] <a href="https:&#x2F;&#x2F;muki.io" rel="nofollow">https:&#x2F;&#x2F;muki.io</a>
mariocesar超过 5 年前
It&#x27;s not VanillaJS but it feels like it <a href="https:&#x2F;&#x2F;github.com&#x2F;alpinejs&#x2F;alpine&#x2F;" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;alpinejs&#x2F;alpine&#x2F;</a> I have been using alpinejs and is really easy to start and complete! something that is difficult to have together.
mLuby超过 5 年前
Love these!<p>Here&#x27;s Emoji Tetris in 240 lines. Live demo: <a href="https:&#x2F;&#x2F;gist.github.com&#x2F;mLuby&#x2F;73316b08c31015e1da813e1fbbed890a#gistcomment-3075305" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;mLuby&#x2F;73316b08c31015e1da813e1fbbed89...</a><p>Can also run in NodeJS like so:<p><pre><code> $ node tetris.html</code></pre>
beardedman超过 5 年前
We need more of these!
评论 #22233013 未加载
erikbye超过 5 年前
Very simple new tab replacement with todos for Firefox using vanilla js.<p><a href="https:&#x2F;&#x2F;addons.mozilla.org&#x2F;en-US&#x2F;firefox&#x2F;addon&#x2F;newtabtodo&#x2F;" rel="nofollow">https:&#x2F;&#x2F;addons.mozilla.org&#x2F;en-US&#x2F;firefox&#x2F;addon&#x2F;newtabtodo&#x2F;</a>
aliswe超过 5 年前
I&#x27;m making an open source .NET Core CMS where the UI is written in non-transpiled ES6 run natively in the browser - including imports through Javascript modules
klundqist超过 5 年前
I like the approach, but it breaks as soon as you have to support IE11.
godmode2019超过 5 年前
Many of these did not work on mobile. Samsung S5 for context
评论 #22233479 未加载
marknadal超过 5 年前
I implemented an entire database in VanillaJS:<p>It runs in-production with 10M+ monthly users!<p><a href="https:&#x2F;&#x2F;github.com&#x2F;amark&#x2F;gun" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;amark&#x2F;gun</a> ~13KB<p>I get a lot of hate for not-using-2ton-framework-of-the-month.<p>But I think prioritizing performance is worth the flack.<p>Seeing repos&#x2F;articles like this deeply warm my heart, maybe us VanillaJS devs are not alone after all!<p>Does anybody have other favorite VanillaJS projects, that they could share?
评论 #22233460 未加载
评论 #22237034 未加载
评论 #22234578 未加载
tasogare超过 5 年前
I just finished coding a few functions in pure Javascript I need for a project (parsing turtle files I have ownership one). After searching for libraries and having read their Github project&#x27;s Readme, I choose to implement them by myself because making them working in browser (most target Node) and understanding their API would have take longer than doing it myself anyway. The front-end tooling has became a huge mess of tools (none of which I have experience with) so I always keep it to vanilla JS (or TS) to progress on my project instead of learning a tool that might not exists in 3 or 5 years.