pixi-wheels

TargetAdapterConfig

pixi-wheels


pixi-wheels / index / TargetAdapterConfig

Interface: TargetAdapterConfig

Defined in: adapter/targetAdapter.ts:13

A serialisable description of how to read a wheel target out of a server response: which field, interpreted how. This is the shape the studio exports and createTargetAdapter compiles.

const adapter = createTargetAdapter({ by: 'value', path: 'bonus.wheel.multiplier' });
wheel.setResult(adapter(response));

Properties#

PropertyTypeDescriptionDefined in
by"angle" | "position" | "section" | "index" | "value"How the field is interpreted.adapter/targetAdapter.ts:15
indexBase?number'index' only: what the server calls the first section. Default 0. Some backends number sectors from 1.adapter/targetAdapter.ts:26
offsetPath?stringOptional dotted path to a 0..1 offset within the section (id / index / value forms).adapter/targetAdapter.ts:21
pathstringDotted path into the response, e.g. 'result.wheel.sectorIndex'.adapter/targetAdapter.ts:17
pick?"random" | "first" | "last"'value' only: which of several matching sections to use. Default 'random'.adapter/targetAdapter.ts:19