@linvix-sistemas/react-native-tectoysunmisdk
Version:
Pacote de comunicação com o hardware de Sunmi/Tectoy Automação, para efetuar impressão, comunicação com LCD entre outros.
48 lines (42 loc) • 1.3 kB
JavaScript
import { NativeModules } from 'react-native';
const {
TectoySunmiSdk
} = NativeModules;
/**
* Controla o LCD.
* @param funcao TectoyLCDFuncaoType
*/
const ControlarLCD = async funcao => {
try {
return await TectoySunmiSdk.LCD_ControlarLCD(funcao);
} catch (error) {
throw error;
}
};
const EnviarTexto = async function () {
let texto = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
let tamanho_fonte = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 16;
let preencher = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
try {
if (tamanho_fonte > 40) {
throw new Error('Tamanho da fonte não pode ser maior do que 40');
}
return await TectoySunmiSdk.LCD_EnviarTexto(texto, tamanho_fonte, preencher);
} catch (error) {
throw error;
}
};
const EnviarTextos = async data => {
try {
return await TectoySunmiSdk.LCD_EnviarTextos(data.texto1, data.texto1_peso_tamanho, data.texto2, data.texto2_peso_tamanho, data.texto3, data.texto3_peso_tamanho);
} catch (error) {
throw error;
}
};
const NativeModuleTectToySunmiLCDSDK = {
ControlarLCD,
EnviarTexto,
EnviarTextos
};
export default NativeModuleTectToySunmiLCDSDK;
//# sourceMappingURL=tectoysunmi-lcd.js.map