How to use the lwc.registerComponent 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 / @lwc / compiler / src / __tests__ / fixtures / expected-sources-metadata.js View on Github external
static: {}
    },
    wiredMethod: {
        adapter: getHello,
        params: {
        name: "publicProp"
        },
        static: {
        fields: ['one', 'two']
        },
        method: 1
    }
    }
});

var foo = registerComponent(Metadata, {
    tmpl: _tmpl
});
const HELLOWORLD = "hello world!";
function ohai(name) {
    return "ohai, " + name;
}

export default foo;
export { HELLOWORLD, ohai };
github salesforce / lwc / packages / @lwc / compiler / src / __tests__ / fixtures / expected-typescript-extension.js View on Github external
tmpl.stylesheetTokens = {
    hostAttribute: "x-typescript_typescript-host",
    shadowAttribute: "x-typescript_typescript"
};
const Test = 1;
class ClassAndTemplate extends LightningElement {
    constructor() {
        super();
        this.t = Test;
        this.counter = 0;
    }
}
registerDecorators(ClassAndTemplate, {
    fields: ["t"]
});
var typescript = registerComponent(ClassAndTemplate, {
    tmpl: _tmpl
});
export default typescript;
github salesforce / lwc / packages / lwc-compiler / src / __tests__ / fixtures / expected-node-env-prod.js View on Github external
import { registerTemplate, registerComponent, LightningElement } from 'lwc';
function tmpl($api, $cmp, $slotset, $ctx) {
    return [];
}
var _tmpl = registerTemplate(tmpl);
class ClassAndTemplate extends LightningElement {
    connectedCallback() {
        this.root.querySelector('outsideOfProductionCheck');
    }
}
var node_env = registerComponent(ClassAndTemplate, {
    tmpl: _tmpl
});
export default node_env;
github salesforce / lwc / packages / @lwc / compiler / src / __tests__ / fixtures / expected-inline-styles.js View on Github external
import stylesheet0 from '@salesforce/designSystem/index.css';
function tmpl($api, $cmp, $slotset, $ctx) {
    return [];
}
var _tmpl = registerTemplate(tmpl);
function stylesheet(hostSelector, shadowSelector, nativeShadow) {
    return "h1" + shadowSelector + " {}\n";
}
const stylesheets = [stylesheet0, stylesheet];
tmpl.stylesheets = stylesheets;
tmpl.stylesheetTokens = {
    hostAttribute: "x-inline_style_inline_style-host",
    shadowAttribute: "x-inline_style_inline_style"
};
class Foo extends LightningElement {}
var inline_style = registerComponent(Foo, {
tmpl: _tmpl
});
export default inline_style;
github salesforce / lwc / packages / @lwc / compiler / src / __tests__ / fixtures / expected-implicit-explicit.js View on Github external
var _implicitStylesheets = [stylesheet];
function tmpl($api, $cmp, $slotset, $ctx) {
return [];
}
var _tmpl = registerTemplate(tmpl);
const stylesheets = [_implicitStylesheets];
tmpl.stylesheets = stylesheets;
if (_implicitStylesheets) {
    tmpl.stylesheets.push.apply(tmpl.stylesheets, _implicitStylesheets);
}
tmpl.stylesheetTokens = {
    hostAttribute: "x-explicit_like_implicit_explicit_like_implicit-host",
    shadowAttribute: "x-explicit_like_implicit_explicit_like_implicit"
};
class ExplicitStyles extends LightningElement {}
var explicit_like_implicit = registerComponent(ExplicitStyles, {
    tmpl: _tmpl
});
export default explicit_like_implicit;
github salesforce / lwc / packages / @lwc / compiler / src / __tests__ / fixtures / expected-styled.js View on Github external
key: 0
}, []), api_custom_element("x-foo", _xFoo, {
key: 1
}, [])];
}
var _tmpl = registerTemplate(tmpl);
tmpl.stylesheets = [];
if (_implicitStylesheets) {
tmpl.stylesheets.push.apply(tmpl.stylesheets, _implicitStylesheets);
}
tmpl.stylesheetTokens = {
hostAttribute: "x-styled_styled-host",
shadowAttribute: "x-styled_styled"
};
class Styled extends LightningElement {}
var styled = registerComponent(Styled, {
tmpl: _tmpl
});
export default styled;
github salesforce / lwc / packages / @lwc / compiler / src / __tests__ / fixtures / expected-external-styles.js View on Github external
}
var _implicitStylesheets = [stylesheet0, stylesheet];
function tmpl($api, $cmp, $slotset, $ctx) {
return [];
}
var _tmpl = registerTemplate(tmpl);
tmpl.stylesheets = [];
if (_implicitStylesheets) {
tmpl.stylesheets.push.apply(tmpl.stylesheets, _implicitStylesheets);
}
tmpl.stylesheetTokens = {
hostAttribute: "x-external_style_external_style-host",
shadowAttribute: "x-external_style_external_style"
};
class Foo extends LightningElement {}
var external_style = registerComponent(Foo, {
tmpl: _tmpl
});
export default external_style;
github salesforce / lwc / packages / lwc-compiler / src / __tests__ / fixtures / expected-node-env-dev.js View on Github external
import { registerTemplate, registerComponent, LightningElement } from 'lwc';
function tmpl($api, $cmp, $slotset, $ctx) {
    return [];
}
var _tmpl = registerTemplate(tmpl);
class ClassAndTemplate extends LightningElement {
    connectedCallback() {
        {
            this.root.querySelector('insideOfProductionCheck');
        }
        this.root.querySelector('outsideOfProductionCheck');
    }
}
var node_env = registerComponent(ClassAndTemplate, {
    tmpl: _tmpl
});
export default node_env;