Sequencer
Use a Charset to increment or decrement changes to DigitizedValues
. A sequencer has the ability to stop after a defined set of changes.
Instantiate
TS
function useSequencer(): UseSequencer;
function useSequencer(options: SequencerOptions): UseSequencer;
function useSequencer(options?: SequencerOptions): UseSequencer;
Props
TS
type SequencerOptions = {
/**
* The charset instance or options used to generate a charset.
*/
charset?: UseCharset | UseCharsetOptions;
/**
* The options passed the function that ensure the array structures are the same.
*/
matchArray?: MatchArrayStructureOptions;
/**
* A call that determines when the sequencer should stop.
*/
stopWhen?: StopPredicateFunction<[current?: DigitizedValue, target?: DigitizedValue | DigitizedValues]>;
/**
* A number of changes that stops the sequencer.
*/
stopAfterChanges?: number;
};
TS
type StopPredicateFunction<T extends CallbackParams<any[]> = any[]> = TrackChangesCallback<T, boolean>;
Returns
TS
type UseSequencer = {
/**
* The charset used by the sequencer.
*/
charset: string[];
/**
* Decrement the current value towards the target value.
*/
decrement: (current: FaceValue<any>, target: FaceValue<any>, count?: number, backwards?: boolean) => FaceValue<any>;
/**
* Increment the current value towards the target value.
*/
increment: (current: FaceValue<any>, target: FaceValue<any>, count?: number, backwards?: boolean) => FaceValue<any>;
};
Returns
TS
type UseSequencer = {
/**
* The charset used by the sequencer.
*/
charset: string[];
/**
* Decrement the current value towards the target value.
*/
decrement: (current: FaceValue<any>, target: FaceValue<any>, count?: number, backwards?: boolean) => FaceValue<any>;
/**
* Increment the current value towards the target value.
*/
increment: (current: FaceValue<any>, target: FaceValue<any>, count?: number, backwards?: boolean) => FaceValue<any>;
};