@moser-inc/moser-labs-custom-elements
v1.1.6
Published
Custom elements based components for use across frameworks.
Downloads
18
Keywords
Readme
Moser Labs Custom Elements
This package contains a collection of custom elements that can be used in any web application.
Installation
npm i @moser-inc/moser-labs-custom-elements
Usage
For these custom elements to function properly, you must first authenticate the user with Keycloak and call the provided authenticateCustomElements
function before registering.
import Keycloak from 'keycloak-js';
import { authenticateCustomElements, registerCustomElements } from '@moser-inc/moser-labs-custom-elements';
const keycloak = new Keycloak('/keycloak.json');
keycloak.init({ onLoad: 'login-required' }).then((isAuthenticated) => {
if (!isAuthenticated) return;
authenticateCustomElements(keycloak);
registerCustomElements();
});
For greater flexibility, you are also able to import and define each custom element individually rather than registering them all at once.
import { LabsAppSwitcher, registerCustomElements } from '@moser-inc/moser-labs-custom-elements';
// Register all custom elements at once
registerCustomElements();
// Or register each custom element individually as needed
customElements.register('labs-app-switcher', LabsAppSwitcher);