Skip to main content

KeywordDetector

Keyword detector.

TypeNameInterface Description
Variablesenabled: boolean

Function: Whether the detector is enabled.

VariableseventEmitter: IEventEmitter

Function: The event emitter.

VariablestargetKeywords: string[]

Function: The target keywords.

Examples

eventEmitter: IEventEmitter

this.keywordDetector.eventEmitter.on(APJS.KeywordEventType.KeywordHit, (e) => {
const words = e.args[0];
console.log("Detected:", words);
});

targetKeywords: string[]

this.keywordDetector.targetKeywords = ["start", "stop"];

Use Case

@component()
export class NewBehaviourScript extends APJS.BasicScriptComponent {
onStart() {
// TODO: instantiate / use KeywordDetector here
}
onUpdate(deltaTime: number) {
}
}
Copyright © 2026 TikTok. All rights reserved.
About TikTokHelp CenterCareersContactLegalTerms of ServicePrivacy PolicyCookies