/**
 * 设备信息、能力相关接口
 */
import { callNative } from './util';
import * as eventHandlers from './util/eventHandlers';

export default {
    /**
     * 获取输入框选择范围
     *
     * @param {object} options
     * @param {function} options.success 接口调用成功的回调
     * @param {function} options.fail 接口调用失败的回调
     */
    getSelectedTextRange(options = {}) {
        const { success = () => {} } = options;
        options.success = ({start = 0, end = 0}) => {
            return success({start, end});
        };
        callNative('getSelectedTextRange', options);
    },
    onKeyboardHeightChange(callback = () => {}) {
        eventHandlers.keyboardHandlers.push(callback);
    }
};
