mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 19:57:22 +08:00
Moved to Plugins
This commit is contained in:
61
ionic/plugins/keyboard/keyboard.ts
Normal file
61
ionic/plugins/keyboard/keyboard.ts
Normal file
@ -0,0 +1,61 @@
|
||||
import * as Rx from 'rx';
|
||||
|
||||
import * as util from 'ionic/util';
|
||||
import {NativePlugin} from '../plugin';
|
||||
|
||||
/**
|
||||
* Manage the native keyboard. Note: this plugin performs mainly in the native
|
||||
* app context. Most operations are non-functional in a normal web browser as
|
||||
* keyboard control is limited.
|
||||
*/
|
||||
@NativePlugin({
|
||||
name: 'Keyboard',
|
||||
platforms: {
|
||||
cordova: 'ionic-plugin-keyboard'
|
||||
},
|
||||
pluginCheck: () => {
|
||||
return window.cordova && window.cordova.plugins && window.cordova.plugins.Keyboard;
|
||||
}
|
||||
})
|
||||
export class Keyboard {
|
||||
/**
|
||||
* Set whether hte accessory bar is visible.
|
||||
*
|
||||
* Note: this only works while running natively (accessory bar cannot be removed
|
||||
* in most web browsers), and by default the bar is hidden when running natively.
|
||||
*
|
||||
* @param isVisible whether the accessory bar is visible
|
||||
*/
|
||||
static setAccessoryBarVisible(isVisible) {
|
||||
this.ifPlugin(() => {
|
||||
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(!isVisible);
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the keyboard.
|
||||
*/
|
||||
static close() {
|
||||
this.ifPlugin(() => {
|
||||
cordova.plugins.Keyboard.close();
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the keyboard.
|
||||
*/
|
||||
static show() {
|
||||
this.ifPlugin(() => {
|
||||
cordova.plugins.Keyboard.show();
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the visibility of the keyboard.
|
||||
*/
|
||||
static isVisible() {
|
||||
return this.ifPlugin(() => {
|
||||
return cordova.plugins.Keyboard.isVisible;
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user