Happy to share that i.haza.website is now available again as a new local-first app!
It was previously a PHP app with a similar goal to what the new version is doing, which is to make it easy to publish web pages. The new version is a web app backed by Holster, and besides publishing websites is great for taking notes and transferring media between devices. Holster provides automatic syncing between devices that you're logged in to, as well as encryption and offline support.
This has been another app where the complimentary goal has been Holster improvements alongside having useful tools. This has been true again because I Haza Website is much more interactive with the Holster API then other apps, so it's caught a few things that have needed fixing.
This blog hasn't been replaced yet because I Haza Website doesn't have some of the blogging features of the old app. Expect that to change soon though, I'm looking forward to moving to the new interface it's much nicer to write in. 😊
Nested listeners
Another Holster release to add a new nested listener feature that I've needed for multiple projects now. In RSStream I added it outside of Holster itself, since I wasn't sure how often I would need it.
The idea is that you add a listener to a query in Holster, but that query always refers to a particular node. That node can reference other nodes, but those references don't change. So even though the API chains nodes together you need to explicitly list which ones you want to listen to changes on. The external way to do this is to create on() callbacks for each of the child nodes in the parent's on() callback. This works fine, but the code is really the same no matter what the project. So it's now included with Holster and just needs the extra parameter to the parent query to set up all listeners below that point. They're also automatically removed when the parent off() is called.
I asked Claude for a simple example and it of course gave a stand alone example that works in Node 🤖:
import Holster from "@mblaney/holster/src/holster.js"
const holster = Holster()
const user = holster.user()
user.create("alice", "password", () => {
user.auth("alice", "password", () => {
// Without {nested: true}, this listener only fires when a NEW key is
// added to "team" - it won't fire again for a later, value-only
// change to an EXISTING member, because that's a write to the
// member's own soul (every object-valued child gets its own), not to
// "team" itself.
user.get("team").on(members => {
console.log("team changed:", members)
}, true, {nested: true})
// A brand new key - the listener above always sees this.
user.get("team").next("alice").put({role: "engineer"})
// A value-only change to an ALREADY-KNOWN key - only reaches the
// listener because of {nested: true}. Without it, this write would
// be silently missed.
setTimeout(() => {
user.get("team").next("alice").put({role: "lead engineer"})
}, 100)
})
})
I Haza Website
It was previously a PHP app with a similar goal to what the new version is doing, which is to make it easy to publish web pages. The new version is a web app backed by Holster, and besides publishing websites is great for taking notes and transferring media between devices. Holster provides automatic syncing between devices that you're logged in to, as well as encryption and offline support.
This has been another app where the complimentary goal has been Holster improvements alongside having useful tools. This has been true again because I Haza Website is much more interactive with the Holster API then other apps, so it's caught a few things that have needed fixing.
This blog hasn't been replaced yet because I Haza Website doesn't have some of the blogging features of the old app. Expect that to change soon though, I'm looking forward to moving to the new interface it's much nicer to write in. 😊
Nested listeners
The idea is that you add a listener to a query in Holster, but that query always refers to a particular node. That node can reference other nodes, but those references don't change. So even though the API chains nodes together you need to explicitly list which ones you want to listen to changes on. The external way to do this is to create
on()callbacks for each of the child nodes in the parent'son()callback. This works fine, but the code is really the same no matter what the project. So it's now included with Holster and just needs the extra parameter to the parent query to set up all listeners below that point. They're also automatically removed when the parentoff()is called.I asked Claude for a simple example and it of course gave a stand alone example that works in Node 🤖:
import Holster from "@mblaney/holster/src/holster.js" const holster = Holster() const user = holster.user() user.create("alice", "password", () => { user.auth("alice", "password", () => { // Without {nested: true}, this listener only fires when a NEW key is // added to "team" - it won't fire again for a later, value-only // change to an EXISTING member, because that's a write to the // member's own soul (every object-valued child gets its own), not to // "team" itself. user.get("team").on(members => { console.log("team changed:", members) }, true, {nested: true}) // A brand new key - the listener above always sees this. user.get("team").next("alice").put({role: "engineer"}) // A value-only change to an ALREADY-KNOWN key - only reaches the // listener because of {nested: true}. Without it, this write would // be silently missed. setTimeout(() => { user.get("team").next("alice").put({role: "lead engineer"}) }, 100) }) })