@damsenviet/kle
v1.0.2
Published
A JavaScript library for interacting with KLE JSON and KLE data structures.
Downloads
7
Readme
kle-js
A JavaScript library for interacting with KLE JSON and KLE data structures.
Originally ported from keyboard-layout-editor with improvements to make the source code increasingly portable across different language platforms.
Table of Contents
Documentation
To view documentation, examples, visit the documentation site.
Installation
To install and use the library, choose an installation method listed below.
- NPM
npm install @damsenviet/kle
- YARN
yarn add @damsenviet/kle
- CDN
<!-- available under the global namespace 'kle' -->
<script src="https://unpkg.com/@damsenviet/kle"></script>
Quick Start
This quick start demo demonstrates parsing a KLE JSON.
const fs = require('fs');
const path = require('path');
const { Keyboard } = require('@damsenviet/kle');
// relative to this file
const jsonRelativePath = './keyboard.json';
const jsonAbsolutePath = path.join(__dirname, jsonRelativePath);
const keyboardJson = JSON.parse(fs.readFileSync(jsonAbsolutePath, 'utf-8'))
const keyboard = Keyboard.fromJSON(keyboardJson);
for (const key of Keyboard.keys) {
for (const label of key.labels) {
// pass
}
}
The schemas for KLE JSON can be found at kle-json.
Contributing
There are many ways to contribute to this project.
For more information please see the contributing guidelines.