Keyboard

Keyboard

Control the Virtual Keyboard state Note:

You must wait for the Agent to initialise before calling any of these methods.

For ChromeOS you need to disable the Chrome Virtual Keyboard in order to fully manage its state.

Methods

(async) disableKeyboard() → {Promise}

Disable the Virtual Keyboard

Example
import Agent from '@meldcx/agent'

const agent = new Agent();

// Using standard Promises
agent.onReadyAsync()
     .then(() => {
         agent.Keyboard.disableKeyboard()
             .then(() => {
                 console.log('The keyboard has been disabled');
             });
     });

// Using async/await (Recommended)
const disableKeyboard = async() => {
     await agent.onReadyAsync();
     await agent.Keyboard.disableKeyboard();
     console.log('The keyboard has been disabled');
};

disableKeyboard(); // Call the above function

(async) enableKeyboard() → {Promise}

Enable the Virtual Keyboard

Example
import Agent from '@meldcx/agent'

const agent = new Agent();

// Using standard Promises
agent.onReadyAsync()
     .then(() => {
         agent.Keyboard.enableKeyboard()
             .then(() => {
                 console.log('The keyboard has been enabled');
             });
     });

// Using async/await (Recommended)
const enableKeyboard = async() => {
     await agent.onReadyAsync();
     await agent.Keyboard.enableKeyboard();
     console.log('The keyboard has been enabled');
};

enableKeyboard(); // Call the above function

(async) getKeyboardState() → {Promise.<Boolean>}

Get the state of the Native Virtual Keyboard

(async) restrictFeatures() → {Promise}

Restrict Features on Virtual Keyboard

Example
import Agent from '@meldcx/agent'

const agent = new Agent();

// Prepare the configuration items you need
// You can leave out any you don't need
const config = {
     autoCompleteEnabled: true,
     autoCorrectEnabled: true,
     hadwritingEnabled: true,
     spellCheckEnabled: true,
     voiceInputEnabled: true,
}

// Using standard Promises
agent.onReadyAsync()
     .then(() => {
         agent.Keyboard.restrictFeatures({config})
             .then(() => {
                 console.log('The keyboard settings have been adjusted');
             });
     });

// Using async/await (Recommended)
const restrictFeatures = async() => {
     await agent.onReadyAsync();
     await agent.Keyboard.restrictFeatures({config});
     console.log('The keyboard settings have been adjusted');
};

restrictFeatures(); // Call the above function