On this pageFunctions
Runtime
Creates a Foldkit application with URL routing and returns a runtime that can be passed to run.
<Model, Message extends {
_tag: string
}, StreamDepsMap extends Struct<Fields>, Flags, Resources = never, ManagedResourceServices = never>(config: ApplicationConfigWithFlags<Model, Message, StreamDepsMap, Flags, Resources, ManagedResourceServices>): MakeRuntimeReturn
<Model, Message extends {
_tag: string
}, StreamDepsMap extends Struct<Fields>, Resources = never, ManagedResourceServices = never>(config: ApplicationConfigWithoutFlags<Model, Message, StreamDepsMap, Resources, ManagedResourceServices>): MakeRuntimeReturnCreates a Foldkit element (no URL routing) and returns a runtime that can be passed to run.
<Model, Message extends {
_tag: string
}, StreamDepsMap extends Struct<Fields>, Flags, Resources = never, ManagedResourceServices = never>(config: ElementConfigWithFlags<Model, Message, StreamDepsMap, Flags, Resources, ManagedResourceServices>): MakeRuntimeReturn
<Model, Message extends {
_tag: string
}, StreamDepsMap extends Struct<Fields>, Resources = never, ManagedResourceServices = never>(config: ElementConfigWithoutFlags<Model, Message, StreamDepsMap, Resources, ManagedResourceServices>): MakeRuntimeReturnStarts a Foldkit runtime, with HMR support for development.
(foldkitRuntime: MakeRuntimeReturn): voidConfiguration for makeApplication when the application receives initial data via flags.
type ApplicationConfigWithFlags = BaseApplicationConfig<Model, Message, StreamDepsMap, Resources, ManagedResourceServices> & Readonly<{
flags: Effect.Effect<Flags>
Flags: Schema.Schema<Flags, any, never>
init: (flags: Flags, url: Url) => [Model, ReadonlyArray<Command<Message, never, Resources | ManagedResourceServices>>]
}>Configuration for makeApplication without flags.
type ApplicationConfigWithoutFlags = BaseApplicationConfig<Model, Message, StreamDepsMap, Resources, ManagedResourceServices> & Readonly<{
init: (url: Url) => [Model, ReadonlyArray<Command<Message, never, Resources | ManagedResourceServices>>]
}>The init function type for applications, receives the current URL and optional flags.
type ApplicationInit = Flags extends void
? (url: Url) => [Model, ReadonlyArray<Command<Message, never, Resources | ManagedResourceServices>>]
: (flags: Flags, url: Url) => [Model, ReadonlyArray<Command<Message, never, Resources | ManagedResourceServices>>]Configuration for browser URL integration with handlers for URL requests and URL changes.
type BrowserConfig = Readonly<{
onUrlChange: (url: Url) => Message
onUrlRequest: (request: UrlRequest) => Message
}>Configuration for makeElement when the element receives initial data via flags.
type ElementConfigWithFlags = BaseElementConfig<Model, Message, StreamDepsMap, Resources, ManagedResourceServices> & Readonly<{
flags: Effect.Effect<Flags>
Flags: Schema.Schema<Flags, any, never>
init: (flags: Flags) => [Model, ReadonlyArray<Command<Message, never, Resources | ManagedResourceServices>>]
}>Configuration for makeElement without flags.
type ElementConfigWithoutFlags = BaseElementConfig<Model, Message, StreamDepsMap, Resources, ManagedResourceServices> & Readonly<{
init: () => [Model, ReadonlyArray<Command<Message, never, Resources | ManagedResourceServices>>]
}>The init function type for elements, with an optional flags parameter when Flags is not void.
type ElementInit = Flags extends void
? () => [Model, ReadonlyArray<Command<Message, never, Resources | ManagedResourceServices>>]
: (flags: Flags) => [Model, ReadonlyArray<Command<Message, never, Resources | ManagedResourceServices>>]A URL request to an external page (different origin).
type External = CallableTaggedStruct<"External", {
href: typeof String$
}>A URL request to a page within the application (same origin).
type Internal = CallableTaggedStruct<"Internal", {
url: Struct<{
hash: OptionFromSelf<typeof Stringgt;
host: typeof String$
pathname: typeof String$
port: OptionFromSelf<typeof Stringgt;
protocol: typeof String$
search: OptionFromSelf<typeof Stringgt;
}>
}>A configured Foldkit runtime returned by makeElement or makeApplication, passed to run to start the application.
type MakeRuntimeReturn = (hmrModel?: unknown) => Effect.Effect<void>Union of Internal and External URL request types.
const UrlRequest: Union<[
CallableTaggedStruct<"Internal", {
url: Struct<{
hash: OptionFromSelf<typeof Stringgt;
host: typeof String$
pathname: typeof String$
port: OptionFromSelf<typeof Stringgt;
protocol: typeof String$
search: OptionFromSelf<typeof Stringgt;
}>
}>,
CallableTaggedStruct<"External", {
href: typeof String$
}>
]>