In Cocos Creator, you can listen for input through events exposed by the EditBox component. This example reacts when editing begins, the text changes, and editing ends.
1 | const { ccclass, property } = cc._decorator; |
The three events are:
editing-did-began: fired when the user starts editing the input.text-changed: fired whenever the text changes.editing-did-ended: fired when the user finishes editing.
Use whichever events your feature needs. Their callbacks can update the UI, validate input, or perform other actions. Register the listeners at an appropriate lifecycle point such as onLoad, and remove them when the component is destroyed to avoid stale listeners or memory leaks.