Product
Introducing Ruby Support in Socket
Socket is launching Ruby support for all users. Enhance your Rails projects with AI-powered security scans for vulnerabilities and supply chain threats. Now in Beta!
@mamba/core
Advanced tools
Pacotes principais do mamba com alguns códigos essenciais e compartilhados.
Estenda um driver com o driver base.
import extendDriver from '@mamba/core/index.js';
/* Optional Driver wrapper path */
import wrappers from './wrappers.js';
export default extendDriver(driverTarget, wrappers);
Fornece constante da moeda no POS.
import { CURRENCY } from '@mamba/core';
CURRENCY.LIMIT; // 999999.99
Fornece os mapas-chave e nomes-chave específicos do POS.
import { KEYBOARD } from '@mamba/core';
const { KEY_NAMES, KEY_NAMES_LIST } = KEYBOARD;
KEY_NAMES.ENTER; // 'enter'
KEY_NAMES_LIST; // ['CLOSE', 'BACK', 'ENTER', 'HELP', 'SHORTCUTS', 'SPACE', 'KEYUP', 'ARROW_UP', 'KEYDOWN', 'ARROW_DOWN', 'F24', 'F23', 'KEY_0', 'KEY_1', 'KEY_2', 'KEY_3', 'KEY_4', 'KEY_5', 'KEY_6', 'KEY_7', 'KEY_8', 'KEY_9']
Values:
{
CLOSE: 'close',
BACK: 'back',
ENTER: 'enter',
HELP: 'help',
SHORTCUTS: 'shortcuts',
SPACE: 'space',
F24: 'F24',
F23: 'F23',
KEY_0: '0',
KEY_1: '1',
KEY_2: '2',
KEY_3: '3',
KEY_4: '4',
KEY_5: '5',
KEY_6: '6',
KEY_7: '7',
KEY_8: '8',
KEY_9: '9',
/**
* @deprecated Use `ARROW_UP`
*/
KEYUP: 'keyup',
ARROW_UP: 'keyup',
/**
* @deprecated Use `ARROW_DOWN`
*/
KEYDOWN: 'keydown',
ARROW_DOWN: 'keydown',
}
import { KEYBOARD } from '@mamba/core';
const { KEY_CODES, KEY_CODES_LIST } = KEYBOARD;
KEY_CODES.ENTER; // 13
KEY_CODES_LIST; // [13, 8, 8, 27, 17, 16, 134, 135, 32, 38, 40, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57]
Values:
{
BACK: 8,
ENTER: 13,
SHORTCUTS: 16,
HELP: 17,
CLOSE: 27,
SPACE: 32,
ARROW_UP: 38,
ARROW_DOWN: 40,
KEY_0: 48,
KEY_1: 49,
KEY_2: 50,
KEY_3: 51,
KEY_4: 52,
KEY_5: 53,
KEY_6: 54,
KEY_7: 55,
KEY_8: 56,
KEY_9: 57,
F23: 134,
F24: 135,
/**
* @deprecated Use `ARROW_UP`
*/
KEYUP: 38,
/**
* @deprecated Use `ARROW_DOWN`
*/
KEYDOWN: 40,
}
Códigos de chave mapeados para nomes de chave
import { KEYBOARD } from '@mamba/core';
const { KEY_MAP, KEY_NAMES, KEY_1 } = KEYBOARD;
KEY_MAP.13; // 'Enter'
KEY_MAP[KEY_NAMES.ENTER]; // 'Enter'
KEY_MAP[KEY_1]; // '1'
Values:
{
"8": "back",
"13": "enter",
"16": "shortcuts",
"17": "help",
"27": "close",
"32": "space",
"38": "keyup",
"40": "keydown",
"48": "0",
"49": "1",
"50": "2",
"51": "3",
"52": "4",
"53": "5",
"54": "6",
"55": "7",
"56": "8",
"57": "9",
"134": "F23",
"135": "F24"
}
Digamos que você queira fazer alguma ação na tela com base em alguma chave POS.
<svelte:window on:keyup="onKeyup(event)" />
<script>
import Keyboard from '@mamba/keyboard/api/index.js';
import { KEYBOARD } from '@mamba/core';
export default {
methods: {
/**
* @description handle physical keyboard events
* @param {KeyboardEvent} event
*/
onKeyup(event) {
const { keyCode } = event;
const { KEY_NAMES, KEY_CODES } = KEYBOARD;
const keyName = Keyboard.getKeyName(keyCode);
if (keyName === KEY_NAMES.BACK) {
// Do something with back key name
} else if (keyName === KEY_NAMES.ENTER) {
// Do something with enter key name
}
// Using key code directly
if (keyCode === KEY_CODES.SHORTCUTS) {
// Do something with shortcut key code
}
},
},
};
</script>
FAQs
Mamba QT bindings, wrappers and embbebded hardware handlers
The npm package @mamba/core receives a total of 10 weekly downloads. As such, @mamba/core popularity was classified as not popular.
We found that @mamba/core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket is launching Ruby support for all users. Enhance your Rails projects with AI-powered security scans for vulnerabilities and supply chain threats. Now in Beta!
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.