2015-06-28 18:32:18 +00:00
|
|
|
import {setProperties, getProperties} from '../utils';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Keyboard layout class
|
|
|
|
* @class
|
|
|
|
*/
|
2015-06-28 01:04:18 +00:00
|
|
|
export default class Keyboard {
|
2015-06-28 18:32:18 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @constructor
|
|
|
|
* @param {Object} options
|
|
|
|
*/
|
2015-06-28 16:37:05 +00:00
|
|
|
constructor(options = {keyboard: [], resize_keyboard: false, one_time_keyboard: false, selective: false}) {
|
|
|
|
this.properties = options;
|
2015-06-28 01:04:18 +00:00
|
|
|
}
|
|
|
|
|
2015-06-28 18:32:18 +00:00
|
|
|
/**
|
|
|
|
* Get or set keyboard layout
|
|
|
|
* @param {Array} value
|
|
|
|
* @returns {Keyboard|Array}
|
|
|
|
*/
|
|
|
|
keyboard(value) {
|
|
|
|
if (value) {
|
|
|
|
setProperties({keyboard: value});
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
return getProperties('keyboard');
|
2015-06-28 01:04:18 +00:00
|
|
|
}
|
|
|
|
|
2015-06-28 18:32:18 +00:00
|
|
|
/**
|
|
|
|
* Get or set resize keyboard
|
|
|
|
* @param {boolean} value
|
|
|
|
* @returns {Keyboard|Object}
|
|
|
|
*/
|
|
|
|
resize(value) {
|
|
|
|
if (value) {
|
|
|
|
setProperties({resize_keyboard: value});
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
return getProperties('resize_keyboard');
|
2015-06-28 01:04:18 +00:00
|
|
|
}
|
|
|
|
|
2015-06-28 18:32:18 +00:00
|
|
|
/**
|
|
|
|
* Get or set one time keyboard
|
|
|
|
* @param {boolean} value
|
|
|
|
* @return {Keyboard|Object}
|
|
|
|
*/
|
|
|
|
oneTime(value) {
|
|
|
|
if (value) {
|
|
|
|
setProperties({one_time_keyboard: value});
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
return getProperties('one_time_keyboard');
|
2015-06-28 01:04:18 +00:00
|
|
|
}
|
|
|
|
|
2015-06-28 18:32:18 +00:00
|
|
|
selective(value) {
|
|
|
|
if (value) {
|
|
|
|
setProperties({selective: value});
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
return getProperties('selective');
|
2015-06-28 01:04:18 +00:00
|
|
|
}
|
|
|
|
|
2015-06-28 18:32:18 +00:00
|
|
|
/* setProperties(object) {
|
2015-06-28 16:37:05 +00:00
|
|
|
this.properties = Object.assign(this.properties, object);
|
2015-06-28 18:32:18 +00:00
|
|
|
return this;
|
2015-06-28 16:37:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
getProperties(object) {
|
|
|
|
return object ? this.properties[object] : this.properties;
|
2015-06-28 18:32:18 +00:00
|
|
|
}*/
|
2015-06-28 01:04:18 +00:00
|
|
|
}
|