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
8
Versions
490
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lwrjs/client-modules

  • 0.0.2-alpha41
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
390
decreased by-79.4%
Maintainers
8
Weekly downloads
 
Created
Source

Lightning Web Runtime :: Application Initialization

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

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

This results in the root 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 route 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:
{
    "routes": [
        {
            "id": "example",
            "init": "example/init"
        }
    ]
}

FAQs

Package last updated on 09 Jan 2021

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