An UUID generator as a web component
npm install @advanced-rest-client/uuid-generatorAn UUID v4 generator as a plain web component and an ES module. Made for a web browser.



``sh`
npm install --save @advanced-rest-client/uuid-generator
`javascript`
import { v4 } from '@advanced-rest-client/uuid-generator';
console.log(v4());
`html`
`js
import { LitElement, html } from 'lit-element';
import { v4 } from '@advanced-rest-client/uuid-generator';
class SampleElement extends LitElement {
render() {
return htmlmy component;
}
_someOperation() {
const uuid = v4();
}
}
customElements.define('sample-element', SampleElement);
`
For historic reasons the index.js file contains an export for both the v4 function but also the web component. When using this module in a web worker or in Node this would cause an error.main.js
Instead import the module with the file. For compatibility this file is not set as the module in the package.json file.
`javascript`
import { v4 } from '@advanced-rest-client/uuid-generator/main.js';
`sh`
git clone https://github.com/advanced-rest-client/uuid-generator
cd uuid-generator
npm install
`sh`
npm start
`sh``
npm test