Search
Items tagged with: dev
Here’s a niche gotcha with the clipboard API’s `navigator.clipboard.writeText()` method that’s unique to Safari:
If you access a function from a module within your gesture handler (e.g., click handler), you will get a permission error.
The (sadly hacky and not as robust) workaround is to set a global variable from your module instead.
Full gist:
#Safari #clipboardAPI #JavaScript #ESModules #web #dev #gist
gists/clipboard-writetext-permission-error-when-using-modules-in-safari.md at main
gists - A place for me to post and share small, self-contained code snippets.Codeberg.org
The Evergreen Web section in Kitten’s¹ settings now has its own page too (and uses Kitten’s new Streaming HTML² workflow).
If you have the previous version of your site up somewhere, you can use the 404-to-307 technique³ to forward missing pages to your old site so as not to break the Web.
I’ll add local static archive support later.
¹ https://codeberg.org/kitten/app
² https://ar.al/2024/03/08/streaming-html/
³ https://4042307.org
#Kitten #SmallWeb #EvergreenWeb #StreamingHTML #web #dev #NodeJS #JavaScript
Streaming HTML
Sorry, your browser doesn't support embedded videos. But that doesn’t mean you can’t watch it! You can download the video and watch it with your favourite video player. Building the Streaming HTML counter example.Aral Balkan
Lots to do yet but the new Kitten¹ settings section (that’s common to all Kitten apps / Small Web places) is coming along nicely. (With the general style/layout borrowed from Domain².)
(It’s currently a single page and I’m breaking it up into multiple ones because it’s time.)
Once I’m done with this I should really record a screencast of Kitten’s new backup and restore feature/data portability.
¹ https://codeberg.org/kitten/app
² https://codeberg.org/domain/app
#SmallWeb #Kitten #Domain #SmallTech #web #dev
… JSDB, by the way, is short for JavaScript Database, which is, umm, a JavaScript database.
It’s an in-process, in-memory database for Node.js for Small Web use that persists to an append-only JavaScript – not JSON, JavaScript – transaction log.
JSDB’s very easy to work with because you just use native JavaScript objects and they just automatically get persisted for you.
e.g., Here’s a quick 6-line Kitten app that persists a counter:
https://codeberg.org/kitten/app#using-javascript-database-jsdb-a-not-so-scary-database
Just published a minor update (version 5.1.1) to JavaScript Database (JSDB) that optimises the custom data type¹ serialisation code by removing a redundant return statement:
https://www.npmjs.com/package/@small-tech/jsdb
This change is backwards compatible and shouldn’t require and updates to your projects, including the ones you have in Kitten (which uses JSDB internally).
¹ https://codeberg.org/small-tech/jsdb#custom-data-types
² https://codeberg.org/kitten/app
#JavaScriptDatabase #JavaScript #database #JSDB #Kitten #SmallWeb #NodeJS #web #dev
Just deployed a new Kitten¹ version 🎉
• Adds database backup and restore in your app’s Kitten settings page (/💕/settings)
• Upgrades version of JSDB from 4 to 5²
• You can emit and listen for events on the session object you get from `request.session` in your routes now.
¹ https://codeberg.org/kitten/app
² For migration notes, please see: https://codeberg.org/small-tech/jsdb#migrating-from-earlier-versions-of-jsdf
#Kitten #backupAndRestore #JavaScript #NodeJS #database #JSDB #sessions #SmallWeb #web #dev
Watching The Doors live at The Hollywood Bowl (1968)¹ and hacking on Kitten² and Domain³.
All in all, not a bad way to spend a Saturday afternoon in my book.
(I’ve almost got database backup/restore working in Kitten and I’ve just finished porting Domain to the latest Kitten with JSDB 5⁴.)
¹ https://yewtu.be/watch?v=Q76QBhKHQGc
² https://codeberg.org/kitten/app
³ https://codeberg.org/domain/app
⁴ https://codeberg.org/small-tech/jsdb
#TheDoors #Kitten #Domain #JSDB #SmallWeb #web #dev #music
Mike Conley is a Firefox developer and creator of the long-running video series "The Joy of Coding". You can follow the videos at:
If the videos haven't federated to your server yet, you can browse them all at https://diode.zone/a/mconley/videos
You can also follow Conley's general account at @mconley@mozilla.social
#FeaturedPeerTube #Programming #Coding #Dev #SoftwareDevelopment #Developers #Firefox #Mozilla #PeerTube #PeerTubers
Mike Conley
Diode Zone is a friendly place for original content with a focus on creativity and electronics!Diode Zone
JSDB 5.1.0 published¹ 🎉
• Forgetting to pass a custom class that’s persisted in your database in your `JSDB.open()` call now throws instead of corrupting your database by falling back to using an untyped object.
• Added JSDF ver. 2 to 3 database migration script (i.e., JSDB version 2-4 to 5)²
To install update:
npm install @small-tech/jsdb@5.1.0
¹ https://codeberg.org/small-tech/jsdb/releases
² https://codeberg.org/small-tech/jsdb#version-2-to-3
#JavaScriptDatabase #JavaScript #database JSDB #JSDB5 #NodeJS #SmallTech #SmallWeb #web #dev
jsdb
A zero-dependency, transparent, in-memory, streaming write-on-update JavaScript database for the Small Web that persists to a JavaScript transaction log.Codeberg.org
JSDB 5.0.1 published 🎉
• Fixes #14: Crash if DataProxy getHandler() called on object with null prototype. (https://codeberg.org/small-tech/jsdb/issues/14)
To install update:
npm install @small-tech/jsdb@5.0.1
Learn more about JSDB:
https://codeberg.org/small-tech/jsdb#javascript-database-jsdb
#JavaScriptDatabase #JavaScript #database JSDB #JSDB5 #NodeJS #SmallTech #SmallWeb #web #dev
jsdb
A zero-dependency, transparent, in-memory, streaming write-on-update JavaScript database for the Small Web that persists to a JavaScript transaction log.Codeberg.org
Just wrote a note about a little gotcha with default values for destructured properties of parameter objects in JavaScript that has gotten me a few times:
#JavaScript #destructuring #defaults #parameterObjects #web #dev
gists/default-values-for-destructured-properties-of-parameter-objects-in-javascript.md at main
gists - A place for me to post and share small, self-contained code snippets.Codeberg.org
This is a very neat trick to unset max-height when an HTML element with resize='vertical' set in CSS is resized. So you can have elements initially displayed with a max-height but then resized beyond it:
https://stackoverflow.com/a/60286469
(Should work as is for resize='block' and with the selector tweaked to use "width" for horizontal/inline.)
Little web dev tip: if you have just one address field in your HTML form (e.g., a textarea) but you still want the person filling it in to avail themselves of autocomplete, here’s a little reusable snippet you can use to achieve that:
(Ideally the web spec should be extended to include a full-address value for the autocomplete attribute.)
#HTML #autocomplete #JavaScript #address #web #dev #tip #code
gists/single-html-address-field-with-autocomplete-using-javascript.md at main
gists - A place for me to post and share small, self-contained code snippets.Codeberg.org
This is a niche one and will likely not affect any of the (three?) people playing with Kitten¹ right now but, in any case:
If you persist custom types to your Kitten database, you might be hit by this bug that was introduced when I released versions of Kitten with minified identifiers.
I briefly wrote about what happened, how you can identify if you’re affected, and how you can fix it here:
https://codeberg.org/kitten/app/issues/160#issuecomment-1775375