How to use the lwc.register function in lwc

To help you get started, we’ve selected a few lwc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github salesforce / lwc / packages / integration-tests / src / components / locators / test-locator-check / integration / locator-check / locator-check.js View on Github external
connectedCallback() {
        if (!this.serviceRegistered) {
            register({
                locator: function(component, data, def, context) {
                    const { target, host, targetContext, hostContext } = context.locator.resolved;
                    window.interaction = {
                        target: target,
                        scope: host,
                        context: Object.assign(targetContext || {}, hostContext),
                    };
                },
            });
            this.serviceRegistered = true;
        }
    }