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

WebAIM November 2024 Newsletter

Friday, November 22, 2024

WebAIM November 2024 Newsletter Read this newsletter online at https://webaim.org/newsletter/2024/november Features Using Severity Ratings to Prioritize Web Accessibility Remediation When it comes to

➡️ Why Your Phone Doesn't Want You to Sideload Apps — Setting the Default Gateway in Linux

Friday, November 22, 2024

Also: Hey Apple, It's Time to Upgrade the Macs Storage, and More! How-To Geek Logo November 22, 2024 Did You Know Fantasy author JRR Tolkien is credited with inventing the main concept of orcs and

JSK Daily for Nov 22, 2024

Friday, November 22, 2024

JSK Daily for Nov 22, 2024 View this email in your browser A community curated daily e-mail of JavaScript news React E-Commerce App for Digital Products: Part 4 (Creating the Home Page) This component

Spyglass Dispatch: The Fate of Chrome • Amazon Tops Up Anthropic • Pros Quit Xitter • Brave Powers AI Search • Apple's Lazy AI River • RIP Enrique Allen

Friday, November 22, 2024

The Fate of Chrome • Amazon Tops Up Anthropic • Pros Quit Xitter • Brave Powers AI Search • Apple's Lazy AI River • RIP Enrique Allen The Spyglass Dispatch is a free newsletter sent out daily on

Charted | How the Global Distribution of Wealth Has Changed (2000-2023) 💰

Friday, November 22, 2024

This graphic illustrates the shifts in global wealth distribution between 2000 and 2023. View Online | Subscribe | Download Our App Presented by: MSCI >> Get the Free Investor Guide Now FEATURED

Daily Coding Problem: Problem #1616 [Easy]

Friday, November 22, 2024

Daily Coding Problem Good morning! Here's your coding interview problem for today. This problem was asked by Alibaba. Given an even number (greater than 2), return two prime numbers whose sum will

The problem to solve

Friday, November 22, 2024

​ Use problem framing to define the problem to solve This week, Tom Parson and Krishna Raha share tools and frameworks to identify and address challenges effectively, while Voltage Control highlights

Issue #568: Random mazes, train clock, and ReKill

Friday, November 22, 2024

View this email in your browser Issue #568 - November 22nd 2024 Weekly newsletter about Web Game Development. If you have anything you want to share with our community please let me know by replying to

Whats Next for AI: Interpreting Anthropic CEOs Vision

Friday, November 22, 2024

Top Tech Content sent at Noon! How the world collects web data Read this email in your browser How are you, @newsletterest1? 🪐 What's happening in tech today, November 22, 2024? The HackerNoon

iOS Cocoa Treats

Friday, November 22, 2024

View in browser Hello, you're reading Infinum iOS Cocoa Treats, bringing you the latest iOS related news straight to your inbox every week. Using the SwiftUI ImageRenderer The SwiftUI ImageRenderer