Skip to main content


Ah, the joys of having a built-in native JavaScript database¹ that can persist and load typed JavaScript objects² and an interactive JavaScript shell (REPL)³ in Kitten⁴ :)

:kitten:💕

¹ kitten.small-web.org/reference…
² kitten.small-web.org/tutorials…
³ kitten.small-web.org/reference…
kitten.small-web.org

#Kitten #SmallWeb #development

This entry was edited (1 day ago)
in reply to Aral Balkan

hey my dear Aral 🤍
I hope you are doing well,
Please support my pinned post 🙏🏼🙏🏼
in reply to Fabio Manganiello

@fabio Nope.

Can it do:

export class Day extends CalendarUnit {
/** @type {Array<Slot>} */
slots = this.slots || new Array()
numberOfSlots = this.numberOfSlots || 4
slotDuration = this.slotDuration || 15 // minutes
persistedDate = this.persistedDate || Temporal.Now.zonedDateTimeISO().toJSON()
persistedStartTime = this.persistedStartTime || this.date.withPlainTime('13').toJSON()

// Automatic daily message flags.
sentMorningOfReminder = this.sentMorningOfReminder || false
sentDayBeforeReminder = this.sentDayBeforeReminder || false
sentWelcomeMessage = this.sentWelcomeMessage || false

initialise () {
this.slots ??=
[] this.numberOfSlots ??= 4
this.slotDuration ??= 15
if (this.slots.length === 0) {
for (let i = 0; i < this.numberOfSlots; i++) {
const slot = new Slot()
slot.dayId = this.id
this.addSlot(slot)
}
}
}

get date () {
return Temporal.ZonedDateTime.from(this.persistedDate)
}

set date (date) {
this.persistedDate = date.toJSON() || Temporal.Now.zonedDateTimeISO().toJSON()
}

}

kitten.db.calendar.addDay(new Day())

// ;)