Web Tools #504 - AbortController, Frameworks, Build Tools, JS Utils

Web Tools Weekly
WEB VERSION
Tools for Web Developers

Issue #504 • March 16, 2023

Advertisement

CodiumAI. Generating Meaningful Tests for Busy Devs.
With CodiumAI, you get non-trivial tests (and trivial, too!) suggested right inside your IDE, so you can code smart, create more value, and stay confident when you push.

CodiumAI

By analyzing your code, docstring, and comments, and by interacting with you, TestGPT (by CodiumAI) suggests tests as you code. All you have to do is accept and commit them.

Try Now For Free!

Let's take a quick look at the AbortController API, a relatively new feature in the DOM spec that allows you to cancel asynchronous tasks that are in progress. The main parts of the API are the AbortController() constructor, the signal property, and the abort() method.

I can mimic an asynchronous action by simply creating a Promise that resolves after a set timer. The basic framework of code for this might look something like the following:

// Create the controller
const controller = new AbortController(),
      signal = controller.signal;

const promise = new Promise((resolve, reject) => {
  // Start async action
  const timer = setTimeout(() => {
    resolve('Timer has completed!');
  }, 5000);

  // Listen for abort
  signal.addEventListener('abort', () => {
    clearTimeout(timer);
    // Result if aborted
    console.log("Timer was aborted!");
  });
});

// Result if not aborted
promise.then(result => console.log(result));

// Abort it
controller.abort();

To make it easier to understand, the above code is somewhat brief, so it's not very practical. For example, the controller is immediately aborted but that's not normally what you'd want.

A more realistic example can be found in this CodePen demo. There I'm allowing the user to initiate the timer using a button. Then the timer can be stopped (i.e. the controller is aborted) with another button. This mimics what might take place dynamically in the process of a real app. In the demo, if you abort the timer, you'll have to refresh the page to reset it because a Promise cannot be reset once it's resolved.

The AbortController API can be incorporated in a number of practical ways in order to stop certain actions on the page from continuing, maybe for performance reasons or something else. Some examples:

  • Cancel a network request when the user navigates away from a page.
  • Disable animations when the user scrolls so that that animated portion of the page is no longer visible.
  • Large resources on a page (like images or videos) can be cancelled if they are still in the process of loading but aren't needed anymore. MDN's article on the subject includes a live demo with a cancellable video.
I'm sure you can come up with other examples along the same lines, but you get the gist of its use and how it might come in handy to make pages perform better and provide a better overall experience.

Now on to this week's tools!
 

Web Frameworks

Kobalte
A UI toolkit for building accessible web apps and design systems with SolidJS that provides a set of low-level UI components and primitives that can be the foundation for your design system implementation.

NextBase Lite
A simple but very opinionated Next.js 13 + Supabase boilerplate, built with TypeScript, Tailwind, ESLint, Prettier, Husky, React Query, and much more.

Camome UI
A lightweight and accessible UI framework for React and CSS that enables you to build various styles of components without run-time JavaScript by fully utilizing the power of CSS.

CodiumAI. Generating Meaningful Tests for Busy Devs.
With CodiumAI, you get non-trivial tests (and trivial, too!) suggested right inside your IDE, so you can code smart, create more value, and stay confident when you push. By analyzing your code, docstring, and comments, and by interacting with you, TestGPT (by CodiumAI) suggests tests as you code. All you have to do is accept and commit them.   SPONSORED  

DecaUI
A large suite of React components that are themeable, accessible, include built-in dark mode, and built with Stitches, the CSS-in-JS solution.

React Pro Boilerplate
A React and Next.js boilerplate that also includes TypeScript support, Prettier, and ESLint.

Flowbite-Svelte
An official Flowbite component library for Svelte that includes 30+ components, form controls, typography features, and more.

Flowbite-Svelte

AstroWind
An open-source template for building projects with Astro 2.0 and Tailwind featuring production-ready Lighthouse scores and SEO-ready content and image optimization, and lots more.

Practica.js
Generate a Node.js app that's packed with best practices and simplicity, based on the popular Node.js Best Practices GitHub repo.

Tiny Vue 3 Template
A small template for building Vue projects with no build step, but instead using Vue through a CDN.

shadcn/ui
30+ beautifully designed components, built with Radix UI and Tailwind, that are accessible and customizable and can be used to create your own component library.
 

Build Tools, Bundlers, etc.

Bob
A high-level build tool for microservices, for multi-language projects, to build codebases organized in multiple repositories or in a monorepo.

stale-dep
A CLI tool to check if your node_modules folder is stale compared to the last time you checked.

Typewind
A Babel-based build solution that brings the safety, productivity, and IntelliSense of TypeScript to Tailwind projects with zero bundle size.

Don’t Just Read The News—Make The News
Looking for an edge in business? Look no further than The Information. Their team of award-winning journalists provide exclusive insights into tech and finance, with original reporting, big interviews, and more that you won’t find anywhere else. Subscribe now and save 25%.   SPONSORED  

pacote
An npm fetcher that fetches package manifests and tarballs from the npm registry.

vite-plugin-checker
A Vite plugin that adds Worker-based checks for TypeScript, ESLint, vue-tsc, Stylelint and more.

depngn
Short for "dependency engine", a CLI tool to find out if your dependencies support a given version of Node.

Remix Compute
A Remix adapter and server runtime for Netlify that allows you to deploy your Remix apps to Netlify Edge Functions.

publint
An online tool that lints npm packages for packaging errors, ensuring maximum compatibility across environments (e.g. Vite, Webpack, Rollup, Node.js, etc).

publint

genzo
A Node-based CLI tool to scaffold your projects for development with custom templates from GitHub or your local file system.

vite-plugin-react-swc
A plugin for Vite that enables SWC (the Rust-based build tool) on your dev server with faster refresh and automatic JSX runtime enabled.

Scriptful
An enhancement for package.json scripts that allows you to run multiple scripts at once and reuse them.
 

JavaScript Utilities

Constrain
A library for animated, interactive web figures (e.g. interactive pythagorean theorem, computing the golden ratio, etc.) based on declarative constraint solving.

MiniSearch
A tiny but powerful in-memory full-text search engine written that's respectful of resources and can comfortably run both in Node and the browser.

ScrollyVideo.js
Responsive scrollable videos without obscure video encoding requirements, compatible with React, Svelte, Vue, and plain HTML/JS.

validator.js
A library of string validators and sanitizers that includes about 100 different utilities (e.g isCreditCard, isCurrency, isEmpty, isISBN, and lots more).

Don’t Just Read The News—Make The News
Looking for an edge in business? Look no further than The Information. Their team of award-winning journalists provide exclusive insights into tech and finance, with original reporting, big interviews, and more that you won’t find anywhere else. Subscribe now and save 25%.   SPONSORED  

Lenis
A lightweight smooth effects-on-scroll plugin that's accessible and incorporates features for CSS sticky and IntersectionObserver.

BoxSlider
A small dependency-free library that provides a lightweight, responsive content slider with various slide transition effects for modern browsers. The demo page is pretty impressive!

BoxSlider

html2svg
Convert HTML and Canvas to vector (SVG, PDF) or bitmap (PNG, JPEG, WebP) images using Chromium.

URL Animations
A small library to add loading animations to a website in the browser's address bar. Not for every project, but includes a gallery of examples to check out.

BalanceText
A utility to provide an alternate text wrapping algorithm to ensure that text is rendered so that the amount of text on each line is about the same.

Idiomorph
A JavaScript library for morphing one DOM tree into another, inspired by a couple of other older similar solutions.

Authey
Expose Auth.js REST APIs to any Node.js framework compatible with Connect, the Node.js middleware layer.

Commercial Apps and Classifieds

These are commercial apps, affiliate links, PPC ads, and paid classifieds. Submit yours!
Internal – An all-in-one internal tools platform with database, API, or Google Sheets integration.
JS E-Books Bundle – All my JS and DOM scripting tips bundled into an affordable e-books package.    AD
Browserbear – Easily automate any browser task like testing websites, capturing data and more
Stellate – A fast and reliable GraphQL API with edge caching, metrics, and rate limiting, to help reduce server and database load.
Tech Brew – A 3-times-a-week newsletter with the latest tech news impacting you and your future. AD
JamComments – A Disqus alternative for static sites that's SEO-friendly and ad-free.
Squash – A batch photo editor for Mac to quickly batch convert and resize images, add watermarks, etc.

A Tweet for Thought

Here's a short but informative Tweet thread from Todd Motto where he offers a few lessons on understanding certain concepts in JavaScript.
 
A Tweet for Thought
 

Send Me Your Tools!

Made something? Send links via Direct Message on Twitter @WebToolsWeekly (details here). No tutorials or articles, please. If you have any suggestions for improvement or corrections, feel free to reply to this email.
 

Before I Go...

Someone decided to make FlappyBirdle, the most frustrating game in the history of everything. I'm so angry I can't even talk right now.

Thanks to everyone for subscribing and reading!

Keep tooling,
Louis
@WebToolsWeekly
PayPal.me/WebToolsWeekly

Older messages

Web Tools #503 - Factory Pattern, CSS Tools, Git/CLI, Uncats

Thursday, March 9, 2023

Web Tools Weekly WEB VERSION Issue #503 • March 9, 2023 Advertisement Sharpen your Math, Data, and Computer Science Skills Whether you're a professional looking for an edge in your career or a

Web Tools #502 - Promises, Media/SVG, Build Tools, React

Thursday, March 2, 2023

Web Tools Weekly WEB VERSION Issue #502 • March 2, 2023 Advertisement Sharpen your Math, Data, and Computer Science Skills Whether you're a professional looking for an edge in your career or a

Web Tools #501 - FontFaceSet, JS Libraries, Databases, Jamstack

Thursday, February 23, 2023

Web Tools Weekly WEB VERSION Issue #501 • February 23, 2023 Advertisement Build Internal Tools, Remarkably Fast If you or your team are spending more time on boilerplate code and other redundant work

Web Tools #500 - assert(), Frameworks, JS Utils, Uncats

Friday, February 17, 2023

Web Tools Weekly WEB VERSION Issue #500 • February 16, 2023 Advertisement The New Tab Page You'll Actually Use Ah, the hyperlink. It's the single coolest thing on the web. There wouldn't

Web Tools #499 - JS Libraries, Git/CLI Tools, React

Thursday, February 9, 2023

Web Tools Weekly WEB VERSION Issue #499 • February 9, 2023 Advertisement Practical, No-nonsense UI Design Tips 🔥 If you do any design work, you might struggle to find actually practical UI advice that

You Might Also Like

Data Science Weekly - Issue 581

Thursday, January 9, 2025

Curated news, articles and jobs related to Data Science, AI, & Machine Learning ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏

💻 Issue 444 - Check Out My New CV as a Full Stack .NET Developer!

Thursday, January 9, 2025

This week's Awesome .NET Weekly Read this email on the Web The Awesome .NET Weekly Issue » 444 Release Date Jan 09, 2025 Your weekly report of the most popular .NET news, articles and projects

💎 Issue 451 - Useful things you can do with Rails console

Thursday, January 9, 2025

This week's Awesome Ruby Newsletter Read this email on the Web The Awesome Ruby Newsletter Issue » 451 Release Date Jan 09, 2025 Your weekly report of the most popular Ruby news, articles and

💻 Issue 451 - The best way to iterate over a large array without blocking the main thread

Thursday, January 9, 2025

This week's Awesome JavaScript Weekly Read this email on the Web The Awesome JavaScript Weekly Issue » 451 Release Date Jan 09, 2025 Your weekly report of the most popular JavaScript news, articles

📱 Issue 445 - 🚀 Your Go-To List of 25 Swift Tools and Libraries for Any Project

Thursday, January 9, 2025

This week's Awesome iOS Weekly Read this email on the Web The Awesome iOS Weekly Issue » 445 Release Date Jan 09, 2025 Your weekly report of the most popular iOS news, articles and projects Popular

💻 Issue 369 - 17 Tips from a Senior React Developer

Thursday, January 9, 2025

This week's Awesome React Weekly Read this email on the Web The Awesome React Weekly Issue » 369 Release Date Jan 09, 2025 Your weekly report of the most popular React news, articles and projects

💻 Issue 451 - Mastering Express.js: A Deep Dive

Thursday, January 9, 2025

This week's Awesome Node.js Weekly Read this email on the Web The Awesome Node.js Weekly Issue » 451 Release Date Jan 09, 2025 Your weekly report of the most popular Node.js news, articles and

📱 Issue 448 - The Swift Runtime: Your Silent Partner

Thursday, January 9, 2025

This week's Awesome Swift Weekly Read this email on the Web The Awesome Swift Weekly Issue » 448 Release Date Jan 09, 2025 Your weekly report of the most popular Swift news, articles and projects

💻 Issue 446 - Great things about Rust that aren't just performance

Thursday, January 9, 2025

This week's Awesome Rust Weekly Read this email on the Web The Awesome Rust Weekly Issue » 446 Release Date Jan 09, 2025 Your weekly report of the most popular Rust news, articles and projects

JSK Daily for Jan 9, 2025

Thursday, January 9, 2025

JSK Daily for Jan 9, 2025 View this email in your browser A community curated daily e-mail of JavaScript news Advanced Query Building Techniques in Angular: Queries with Different Connectors The Query