npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@mamba/core

v12.1.0

Published

Mamba QT bindings, wrappers and embbebded hardware handlers

Downloads

379

Readme

Core

Pacotes principais do mamba com alguns códigos essenciais e compartilhados.

Extend

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);

Currency

Fornece constante da moeda no POS.

Limite máximo

import { CURRENCY } from '@mamba/core';

CURRENCY.LIMIT; // 999999.99

Keymap

Fornece os mapas-chave e nomes-chave específicos do POS.

KEY_NAMES

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',
}

KEY_CODES

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,
}

KEYMAP

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"
}

Usage example

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>