Skip to content
Work in progress. These docs describe Spawnite at launch, and some parts are still being built.

definePluginFactory

definePluginFactory<Options, Made>(build): PluginFactory<[Options], Made>

Makes a plugin’s factory from build, which returns the plugin for its options with definePlugin: the call a game lists, rounds(), which makes one plugin for each distinct options the plugin records, so a list written again on each render, and a kit that lists the plugin with the same options as the game, name one plugin. The factory carries the plugin’s handles, read from a call with no options, so they never depend on its options: rounds.systems.advance for an anchor, rounds.commands.start for what a page sends, and the plugin’s name, so another plugin writes requires: [rounds]. As each engine plugin’s factory is made.

Two calls make one plugin when their recorded options are the same JSON and each function and handle they were given is the same object, such as a Team from defineTeam: a handle is compared by identity, so two worlds’ teams of one key are two plugins. A plugin whose options are required, as teams()’s are, names the options its handles are read from in handles, and a game’s call must pass its own.

Type Parameter
Options
Made extends Plugin<SystemHandles<Readonly<Record<string, unknown>>, Readonly<Record<string, unknown>>, Readonly<Record<string, unknown>>, Readonly<Record<string, unknown>>>, Readonly<Record<string, VectorInputDeclaration | AngleInputDeclaration | ButtonInputDeclaration | AxisInputDeclaration>>, Readonly<Record<string, PageActionDeclaration>>, string, Readonly<Record<string, CommandDeclaration<Readonly<Record<string, CommandField>>, string, Readonly<Record<string, ReturnField>> | undefined, boolean, boolean, boolean>>>, Readonly<Record<string, InputContextDeclaration>>>
Parameter Type
build (options?) => Made

PluginFactory<[Options], Made>

definePluginFactory<Options, Made>(build, handles): PluginFactory<[Options], Made>

Makes a plugin’s factory from build, which returns the plugin for its options with definePlugin: the call a game lists, rounds(), which makes one plugin for each distinct options the plugin records, so a list written again on each render, and a kit that lists the plugin with the same options as the game, name one plugin. The factory carries the plugin’s handles, read from a call with no options, so they never depend on its options: rounds.systems.advance for an anchor, rounds.commands.start for what a page sends, and the plugin’s name, so another plugin writes requires: [rounds]. As each engine plugin’s factory is made.

Two calls make one plugin when their recorded options are the same JSON and each function and handle they were given is the same object, such as a Team from defineTeam: a handle is compared by identity, so two worlds’ teams of one key are two plugins. A plugin whose options are required, as teams()’s are, names the options its handles are read from in handles, and a game’s call must pass its own.

Type Parameter
Options
Made extends Plugin<SystemHandles<Readonly<Record<string, unknown>>, Readonly<Record<string, unknown>>, Readonly<Record<string, unknown>>, Readonly<Record<string, unknown>>>, Readonly<Record<string, VectorInputDeclaration | AngleInputDeclaration | ButtonInputDeclaration | AxisInputDeclaration>>, Readonly<Record<string, PageActionDeclaration>>, string, Readonly<Record<string, CommandDeclaration<Readonly<Record<string, CommandField>>, string, Readonly<Record<string, ReturnField>> | undefined, boolean, boolean, boolean>>>, Readonly<Record<string, InputContextDeclaration>>>
Parameter Type
build (options) => Made
handles PluginFactoryOptions<NoInfer<Options>>

PluginFactory<[Options], Made>