WebAPI/KeboardIME: Difference between revisions

Line 192: Line 192:
=== Use cases for each of the methods ===
=== Use cases for each of the methods ===


* For a simple virtual keyboard action (send a character and key events w/ each user action), use <code>sendKey</code>
* For a simple virtual keyboard action (send a character and key events w/ each user action), use <code>sendKey()</code>. TODO: should we allow backspace key to be sent from the method? If not, how do send these non-printable characters and it's effect with key events?
* For backspace key, spellcheck, autocomplete etc, use surrounding text methods
* For spellcheck, autocomplete etc, use surrounding text methods.
* For cursor moment helper features, use <code>setSelectionRange</code> and related attributes.
* For cursor moment helper features, use <code>setSelectionRange()</code> and related attributes.
* For Asian IMEs that sends characters and composition along with the composition events, use <code>setComposition()</code> and <code>endComposition</code>
* For Asian IMEs that sends characters and composition along with the composition events, use <code>setComposition()</code> and <code>endComposition()</code>.


It is important to stick with the given use cases because the web application might need to react with what the user actually do. To test the events currently sent to the web, see http://jsfiddle.net/timdream/YDGgk/ .
It is important to stick with the given use cases because the web application might need to react with what the user actually do. To test the events currently sent to the web, see http://jsfiddle.net/timdream/YDGgk/ .
Confirmed users
478

edits