New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@lwrjs/client-modules

Package Overview
Dependencies
Maintainers
7
Versions
486
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lwrjs/client-modules

  • 0.0.2-alpha14
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.5K
decreased by-2.95%
Maintainers
7
Weekly downloads
 
Created
Source

Lightning Web Runtime :: Application Initialization

The lwr/init module provides APIs which are responsible for:

  • importing static application dependencies
  • defining the root application component(s) into the CustomElementRegistry

This results in the root application component(s) being renderable by the DOM on first page load.

Definition

interface InitAPI {
    init(rootModules: [string, LightningElement][]): void;
}

Usage

import { init } from 'lwr/init';
import xAppRoot from 'x/appRoot';
import xNav from 'x/nav';

init([
    ['x/appRoot', xAppRoot],
    ['x/nav', xNav],
]);

Configuration

The default lwr/init module used by an LWR application can be overridden with these steps:

  1. Create a module exporting an init function which implements the InitAPI interface:
// src/modules/example/init/init.js
export function init(rootModules) {
    rootModules.forEach(([moduleSpecifier, ctor]) => {
        const elementName = toKebabCase(moduleSpecifier);
        customElements.define(elementName, ctor.CustomElementConstructor);
    });
}
  1. Configure the init module specifier in lwr.config.json:
{
    "modules": [],
    "application": {
        "root": "example/app",
        "init": "example/init"
    }
}

FAQs

Package last updated on 18 Sep 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc