开发者社区> 镜像站> NPM> @lwc/engine-core
@lwc/engine-core
Core LWC engine APIs.
Last updated a month ago by pmdartus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @lwc/engine-core 
SYNC missed versions from official npm registry.

@lwc/engine-core

This package contains the core logic shared by different runtime environments. Examples of this include the rendering engine and the reactivity mechanism. Since this package only provides internal APIs for building custom runtimes, it should never be consumed directly in an application.

Usage of internal APIs are prevented by the compiler and are therefore not documented here.

Supported APIs

This package supports the following APIs.

@api

This decorator is used to mark the public fields and the public methods of an LWC component.

import { LightningElement, api } from 'lwc';

class LightningHello extends LightningElement {
    @api
    hello = 'default hello';
}

@track

This decorator should be used on private fields to track object mutations.

import { LightningElement, api, track } from 'lwc';

class LightningHello extends LightningElement {
    @api
    get name() {
        return name.raw;
    }
    set name(value) {
        name.normalized = normalize(value);
    }

    @track
    name = {
        raw: 'Web components ',
        normalized: 'Web Components',
    };
}

@wire

This decorator should be used to wire fields and methods to a wire adapter.

import { LightningElement, wire } from 'lwc';
import { getRecord } from 'recordDataService';

export default class Test extends LightningElement {
    @wire(getRecord, { id: 1 })
    recordData;
}

createContextProvider()

This function creates a context provider, given a wire adapter constructor.

LightningElement

This class should be extended to create an LWC constructor.

import { LightningElement } from 'lwc';

class LightningHello extends LightningElement {
    // component implementation
}

Experimental APIs

Experimental APIs are subject to change, may be removed at any time, and should be used at your own risk!

getComponentDef()

This experimental API provides access to internal component metadata.

isComponentConstructor()

This experimental API enables the identification of LWC constructors.

readonly()

This experimental API enables the creation of a reactive readonly membrane around any object value.

register()

This experimental API enables the registration of 'services' in LWC by exposing hooks into the component life-cycle.

sanitizeAttribute()

This experimental API enables the sanitization of attribute values by external services.

unwrap()

This experimental API enables the removal of an object's observable membrane proxy wrapper.

Current Tags

  • 1.7.15-alpha3                                ...           canary (3 months ago)
  • 1.8.7                                ...           latest (a month ago)
  • 1.9.5                                ...           next (an hour ago)
  • 1.7.10-228.5                                ...           winter21 (2 months ago)

50 Versions

  • 1.9.5                                ...           an hour ago
  • 1.9.4                                ...           3 days ago
  • 1.9.3                                ...           13 days ago
  • 1.9.2                                ...           16 days ago
  • 1.9.1                                ...           23 days ago
  • 1.9.0                                ...           a month ago
  • 1.8.8-alpha.3                                ...           a month ago
  • 1.8.7                                ...           a month ago
  • 1.8.7-alpha.1                                ...           a month ago
  • 1.8.6-alpha.0                                ...           2 months ago
  • 1.8.6                                ...           2 months ago
  • 1.8.5                                ...           2 months ago
  • 1.8.4                                ...           2 months ago
  • 1.7.10-228.5                                ...           2 months ago
  • 1.7.10-228.4                                ...           2 months ago
  • 1.8.3                                ...           2 months ago
  • 1.7.10-228.3                                ...           2 months ago
  • 1.7.10-228.2                                ...           2 months ago
  • 1.8.2                                ...           3 months ago
  • 1.8.1                                ...           3 months ago
  • 1.8.0                                ...           3 months ago
  • 1.7.15-alpha3                                ...           3 months ago
  • 1.7.15-alpha2                                ...           3 months ago
  • 1.7.15-alpha1                                ...           3 months ago
  • 1.7.14-alpha4                                ...           3 months ago
  • 1.7.14-alpha3                                ...           3 months ago
  • 1.7.14-alpha2                                ...           3 months ago
  • 1.7.14                                ...           3 months ago
  • 1.7.14-alpha1                                ...           3 months ago
  • 1.7.13                                ...           3 months ago
  • 1.7.13-alpha1                                ...           3 months ago
  • 1.7.12                                ...           3 months ago
  • 1.7.11                                ...           4 months ago
  • 1.7.11-locker-alpha1                                ...           4 months ago
  • 1.7.10-228.1                                ...           4 months ago
  • 1.7.10                                ...           4 months ago
  • 1.7.9                                ...           4 months ago
  • 1.7.9-alpha2                                ...           4 months ago
  • 1.7.9-alpha1                                ...           4 months ago
  • 1.7.8                                ...           5 months ago
  • 1.7.7                                ...           5 months ago
  • 1.7.6                                ...           5 months ago
  • 1.7.5                                ...           5 months ago
  • 1.7.5-alpha1                                ...           5 months ago
  • 1.7.4                                ...           5 months ago
  • 1.7.3-lockerpreview-alpha1                                ...           5 months ago
  • 1.7.3                                ...           5 months ago
  • 1.7.3-alpha4                                ...           6 months ago
  • 1.7.3-alpha1                                ...           6 months ago
  • 1.7.2                                ...           6 months ago
Downloads
Today 7
This Week 16
This Month 16
Last Day 0
Last Week 0
Last Month 82
Dependencies (0)
None
Dev Dependencies (3)
Dependents (0)
None