You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@lwr-js/bootstrap

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lwr-js/bootstrap

APIs to bootstrap a LWR root application component

0.0.1-alpha6
latest
npmnpm
Version published
Weekly downloads
8
60%
Maintainers
1
Weekly downloads
 
Created
Source

Lightning Web Runtime :: Bootstrap

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

  • importing static application dependencies
  • defining the root application component into the CustomElementRegistry

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

Definition

interface BootstrapAPI {
    bootstrap(rootAppSpecifier: string, rootApp: LightningElement): void;
}

Usage

import { bootstrap } from 'lwr/bootstrap';
import xAppRoot from 'x/appRoot';

bootstrap('x/appRoot', xAppRoot);

Configuration

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

  • Create a module exporting a bootstrap function which implements the BootstrapAPI interface:
// src/modules/example/bootstrap/bootstrap.js
export function bootstrap(rootAppSpecifier, rootApp) {
    const elementName = rootAppSpecifier.replace(/\//, '-');
    customElements.define(elementName, rootApp.CustomElementConstructor);
}
  • Configure the module specifier in lwr.config.json:
{
    "modules": [],
    "application": {
        "root": "example/app",
        "bootstrap": "example/bootstrap"
    }
}

FAQs

Package last updated on 12 Jun 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