Ember's new GJS syntax is now supported by GitHub!
A boring component:
class ActionButton extends Component {
<template>
import { CachedFormula, Cell, Formula } from "@starbeam-lite/core"; | |
import { EventRecorder, TestScheduler } from "@workspace/test-utils"; | |
import { describe, expect, it } from "vitest"; | |
import { subscribe } from "../src/subtle"; | |
import { TAG } from "@starbeam-lite/shared"; | |
describe("subscribe", () => { | |
describe("equivalent to Signal.subtle.Watcher (ported tests)", () => { | |
it("should work", () => { | |
const events = new EventRecorder(); |
Broadly speaking, the idea is that you should be able to create an accessor
decorator that doesn't expose a setter.
I think the most natural way to express this is for the set
function returned by an accessor decorator to have a never
return type. The idea is that such a decorator would result in the type system treating the resulting field as if it was a manually written getter without a setter.
Here's an example scenario:
import { Friend } from "hypothetical-lib";
{ | |
"public": true | |
} |
A factory is a function that returns a new reactive object.
You can use a class as a factory, but it's not required. When you use a class as a factory, its constructor must take zero required arguments.
import { Cell } from "@starbeam/core"; | |
import { useSetup } from "@starbeam/react"; | |
const SYSTEM_LOCALE = Intl.DateTimeFormat().resolvedOptions().locale; | |
const SYSTEM_TZ = Intl.DateTimeFormat().resolvedOptions().timeZone; | |
function Clock({ locale = SYSTEM_LOCALE, timeZone = SYSTEM_TZ }) { | |
const now = useSetup((component) => { | |
const now = Cell(new Date())); |