npm library for typescript
npm install ts-cliche-unions !ts-cliche-unions_MIT !ts-cliche-unions_npm_v
npm install ts-cliche-unions --save
`Usage
Import this module into your TypeScript file.
`
import { KEY } from 'ts-cliche-unions';
` This module can be used to replace key name strings, etc., with constants.
`
// if(ev.key === 'Enter') { ... }
if(ev.key === KEY.Enter) { ... }
`
`
// document.addEventListener('copy', (e) => { ... }
document.addEventListener(EVENT.Copy, (e) => { ... }
`
`
// const link = document.createElement("a");
const link = document.createElement(ELEMENT.A);
`
`
// element.setAttribute('class','test');
element.setAttribute(ATTRIBUTE.Class, 'test');
``* Windows
Chrome (version 48 or lower)
* Mac
Chrome (version 52 or lower)
FireFox (version 48 or lower)
* Linux
Chrome (version 52 or lower)
If you just want to use constants, don't worry about the above.