# API Reference

# Props

Prop name Type Default Value Description
doVerification Boolean true If true, after training gestures the user will be prompted to verify them to establish that the model has been trained correctly. If false, the verification stage will be skipped.
fireOnce Boolean true If true, an event will be fired when a user makes a gesture, but will not be fired again until either a different gesture is detected, or the user first returns to the neutral position.
gestures array undefined See the Gestures prop notes
model String undefined A trained model, in JSON format. If this is not null or undefined, training and verification will be skipped, and the provided model will be used.
neutralTrainingPrompt String 'Maintain a neutral position' Displayed while training the neutral position.
neutralVerification Prompt String 'Verify neutral position' Displayed while training the neutral position.
requiredAccuracy Number 90 A number between 0 and 100. Each gesture must have at least this percent accuracy during verification, otherwise the training cycle will repeat.
showCameraFeed AfterTrainingCycle Boolean true Whether the camera feed will be displayed after the training cycle has finished.
showCameraFeed DuringTraining Boolean true Whether the camera feed will be displayed while training gestures.
showCameraFeed DuringVerification Boolean true Whether the camera feed will be displayed while verifying gestures.
throttleEvents Number 0 Only has an effect if fireOnce is false. Throttles how often an event gets fired (in milliseconds) if the user persists with a gesture. If 0, the event will be fired each frame the user continues persisting with the gesture.
trainingDelay Number 1000 The number of milliseconds to wait after first displaying a prompt to train a gesture before the training of that gesture commences. Should be high enough to give the user time to start doing that gesture.
trainingPromptPrefix String 'Perform a gesture: ' Displayed before a gesture name when training the model.
trainingTime Number 3000 The number of milliseconds to spend taking snapshots from the camera feed and using them to train a model for a gesture.
trainNeutralLast Boolean false By default, the neutral gesture is trained and verified first. If this prop is true, it will be trained and verified last.
verificationDelay Number 1000 The number of milliseconds to wait after first displaying a prompt to verify a gesture before the verification of that gesture commences. Should be high enough to give the user time to start doing that gesture.
verificationPrompt Prefix String 'Verify gesture: ' Displayed before a gesture name when verifying the model.
verificationTime Number 1000 The number of milliseconds to spend taking snapshots from the camera feed and using them to verify that a gesture has been successfully trained.

# gestures prop

The gestures prop is an array of objects for each gesture. Each object can have the following properties:

Property name Type Description
event String Mandatory. The name of the event that will be fired when this gesture is detected.
fireOnce Boolean If true, an event will be fired when a user makes the gesture, but will not be fired again until either a different gesture is detected, or the user first returns to the neutral position.
name String The name of the gesture shown in prompts.
requiredAccuracy Number A number between 0 and 100. The gesture must have at least this percent accuracy during verification, otherwise the training cycle will repeat.
throttleEvent Number Only has an effect if fireOnce is false (on this object or in a prop). Throttles how often an event gets fired (in milliseconds) if the user persists with this gesture. If 0, the event will be fired each frame the user continues persisting with the gesture.
trainingDelay Number How many milliseconds to spend showing the user the prompt before starting to train the gesture.
trainingPrompt String The prompt displayed before and while this gesture is being trained.
trainingTime Number How many milliseconds to spend training the gesture.
verificationDelay Number How many milliseconds to spend showing the user the prompt before starting to verify the gesture.
verificationPrompt String The prompt displayed before and while this gesture is being verified.
verificationTime Number How many milliseconds to spend verifying the gesture.

# Events

Event Argument Description
doneTraining The trained model as a JSON string Emitted when training has finished, and verification is about to start
doneVerification The trained model as a JSON string Emitted when verification has successfully finished. At this point events will be fired if the user repeats the gestures.
neutral Emitted when the neutral position is detected. The frequency is determined by the fireOnce and throttleEvents props.
verificationFailed The failed model as a JSON string Emitted when verification has failed to meet the required accuracy. The training cycle will begin again.

# Custom events

The gestures prop contains an array of objects where the event property has the name of an event that will be fired when the user performs that gesture.

If the gestures prop is not provided, gestures will be determined based on any events being listened to that are not one of the reserved events listed above.

# Slots

Slot Slot Props Description
instructions See the guide Customizes the appearance of the instructions
loading See the guide Customizes the appearance of the loading indicator that initially appears while the Mobilenet model is loading
progress See the guide Customizes the appearance of the progress bar