# developer Lightning Web Components Developer Guide (lwc) - Full Documentation # `@AuraEnabled` Annotations for Continuations Continuations use the `@AuraEnabled` annotation for Apex code. Here are the rules for usage. - **`@AuraEnabled(continuation=true)`** An Apex controller method that returns a continuation must be annotated with `@AuraEnabled(continuation=true)`. - **`@AuraEnabled(continuation=true cacheable=true)`** To cache the result of a continuation action, set `cacheable=true` on the annotation for the Apex callback method. **note:** There’s a space, **not a comma**, between `continuation=true cacheable=true`. ## Caching Considerations It's best practice to set `cacheable=true` on all methods involved in the continuation chain, including the method that returns a `Continuation` object. In this example, the Apex method that returns the continuation, `startRequest()`, and the callback, `processResponse()`, both contain `cacheable=true` in their `@AuraEnabled` annotation. ```apex // Action method @AuraEnabled(continuation=true cacheable=true) public static Object startRequest() { } // Callback method @AuraEnabled(cacheable=true) public static Object processResponse(List labels, Object state) { } ``` ## Cacheable Setting Behavior Here's a table that summarizes the behavior with different settings of the `cacheable` attribute in `@AuraEnabled`. | Method Returning Continuation Object Annotated with `cacheable=true` | Callback Method Annotated with `cacheable=true` | Valid? | Can be Called Using `@wire`? | Is Action Response Cached on Client? | | -------------------------------------------------------------------- | ----------------------------------------------- | ------------------------ | ------------------------------------------- | ------------------------------------ | | Yes | Yes | Yes | Yes | Yes | | Yes | No | No (throws an exception) | N/A | N/A | | No | Yes | Yes | No (all methods must have `cacheable=true`) | No | | No | No | Yes | No | No | **See Also** - [Make Long-Running Callouts with Continuations](https://developer.salesforce.com/docs/platform/lwc/guide/apex-continuations.md) - [Call Apex Methods](https://developer.salesforce.com/docs/platform/lwc/apex/apex.md) # `@salesforce` Modules Modules scoped with `@salesforce` add functionality to Lightning web components at runtime. Modules that are imported without `@salesforce`, like `lightning/uiRecordApi`, contain resources that don't change and are universal to all orgs. Some modules have a fixed set of module identifiers. For example, the `@salesforce/i18n` module supports many identifiers including `@salesforce/i18n/dir` and `@salesforce/i18n/lang`. Some modules have a dynamic set of module identifiers. The set is defined by the organization’s metadata. For example, `@salesforce/schema` accesses an organization’s objects and fields. ## `@salesforce/apex` Import Apex methods from `@salesforce/apex`. The imported methods are functions that the component can call either via `@wire` or imperatively. See [Call Apex Methods](https://developer.salesforce.com/docs/platform/lwc/apex/apex.md). ```javascript import apexMethodName from '@salesforce/apex/Namespace.Classname.apexMethodReference'; @wire(apexMethodName, { apexMethodParams }) propertyOrFunction; ``` - `apexMethodName`—A symbol that identifies the Apex method. - `apexMethodReference`—The name of the Apex method to import. - `Classname`—The name of the Apex class. - `Namespace`—The namespace of the Salesforce organization. Specify a namespace unless the organization uses the default namespace (`c`), in which case don’t specify it. - `apexMethodParams`—An object with properties that match the parameters of the `apexMethod`, if needed. If a parameter value is `null`, the method is called. If a parameter value is `undefined`, the method isn’t called. If the Apex method is overloaded, the choice of what method to call is non-deterministic (effectively random), and the parameters passed may cause errors now or in the future. Don't overload `@AuraEnabled` Apex methods. **important:** `apexMethodParams` is an object. To pass parameter values to an Apex method, pass an object whose properties match the parameters of the Apex method. For example, if the Apex method takes a string parameter, don’t pass a string directly. Instead, pass an object that contains a property whose value is a string. Read the data that's returned by the wire adapter using a property or function. `propertyOrFunction`—A private property or function that receives the stream of data from the wire service. - If a property is decorated with `@wire`, the results are returned to the property’s `data` property or `error` property. - If a function is decorated with `@wire`, the results are returned in an object with a `data` property and an `error` property. **note:** The `data` property and the `error` property are hardcoded values in the API. You must use these values. ```javascript // Example import getAccounts from '@salesforce/apex/MyAccountController.getAccounts'; // Use the wire service to provision data to either a property or a function. // This example provisions data to a property. @wire(getAccounts) accounts; // This example provisions data to a function. @wire(getAccounts) wiredAccounts({ error, data }) { if (data) { this.accounts = data; this.error = undefined; } else if (error) { this.error = error; this.accounts = undefined; } } ``` Import **`getSObjectValue`** from `@salesforce/apex`. Call this method to get a field value from an object retrieved from an Apex method. ```javascript import { getSObjectValue } from "@salesforce/apex"; getSObjectValue(sObject, fieldApiName); ``` - `sObject`—The object returned by the Apex method. - `fieldApiName`—The API name of the field. The value can be either a string or reference to a field imported from `@salesforce/schema`. You can specify up to three **relationship fields** to reference parent objects and fields using this format: `....`. Import **`refreshApex`** from `@salesforce/apex`. Call this method to query the server for updated data returned by Apex, and refresh the cache of a wired property. ```javascript import { refreshApex } from "@salesforce/apex"; refreshApex(valueProvisionedByApexWireService); ``` **note:** The use of `refreshApex` to refresh data from non-Apex wire adapters is deprecated. To refresh record data returned by a non-Apex wire adapter, use [`notifyRecordUpdateAvailable(recordIds)`](https://developer.salesforce.com/docs/platform/lwc/guide/reference-notify-record-update.md) instead. - Where `{valueProvisionedByApexWireService}` is either a property annotated with an Apex `@wire`, or if you annotated a function, the argument that the wired function receives. See [Refresh the Cache When Using `@wire`](https://developer.salesforce.com/docs/platform/lwc/apex/apex-result-caching.md#refresh-the-cache-when-using-wire). **note:** To update a record via imperative Apex, call the Apex method and then call `notifyRecordUpdateAvailable()` to update the cache. The `refreshApex()` function doesn’t refresh data that was fetched by calling an Apex method imperatively. ## `@salesforce/apexContinuation` Import Apex methods from `@salesforce/apexContinuation`. ```javascript // Syntax import apexMethodName from "@salesforce/apexContinuation/Namespace.Classname.apexMethodName"; ``` ```javascript // Example import startRequest from "@salesforce/apexContinuation/SampleContinuationClass.startRequest"; ``` - `apexMethodName`—A symbol that identifies the Apex method. - `apexMethodReference`—The name of the Apex method to import. - `Classname`—The name of the Apex class. - `Namespace`—If the class is in the same namespace as the component, don’t specify a namespace. If the class is in a managed package, specify the namespace of the managed package. See [Make Long-Running Callouts with Continuations](https://developer.salesforce.com/docs/platform/lwc/apex/apex-continuations.md). ## `@salesforce/client/formFactor` ```javascript // Syntax import formFactorPropertyName from @salesforce/client/formFactor ``` ```javascript // Example import CLIENT_FORM_FACTOR from @salesforce/client/formFactor ``` - `formFactorPropertyName`—A name that refers to the form factor of the hardware running the browser. Possible values are: - `Large`—A desktop client. - `Medium`—A tablet client. - `Small`—A phone client. [Pass the form factor](https://developer.salesforce.com/docs/platform/lwc/create/create-client-form-factor.md) to the `getRecordCreateDefaults` wire adapter to get the default layout information and object information for creating a record. ## `@salesforce/community` Import the network ID of the current Experience Builder site from `@salesforce/community/Id`. ```javascript // Syntax import idName from "@salesforce/community/Id"; ``` ```javascript // Example import networkId from "@salesforce/community/Id"; ``` Import the base URL of your Experience Builder site from `@salesforce/community/basePath`. ```javascript // Syntax import basepathname from "@salesforce/community/basePath"; ``` ```javascript // Example import sitePath from "@salesforce/community/basePath"; ``` The base path is the section of the site’s URL that comes after the domain. So if your site domain name is `UniversalTelco.force.com` and `myPartnerSite` was the URL value added when you created the site, the community’s URL is `UniversalTelco.force.com/myPartnerSite/s`. In this case, `myPartnerSite/s` is the base path. See [Get Information About the Current Experience Builder Site](https://developer.salesforce.com/docs/platform/lwc/create/create-community-info.md). **important:** If a component imports `@salesforce/community`, it can target only an Experience Builder page. The component can’t be used in any other Salesforce container. See [Configure a Component for Experience Builder](https://developer.salesforce.com/docs/platform/lwc/use/use-config-for-community-builder.md). ## `@salesforce/contentAssetUrl` Import content asset files from `@salesforce/contentAssetUrl`. ```javascript // Syntax import myContentAsset from "@salesforce/contentAssetUrl/contentAssetReference"; ``` ```javascript // Syntax for assets in managed packages import myContentAsset from "@salesforce/contentAssetUrl/namespace__contentAssetReference"; ``` ```javascript // Example import SALES_WAVE_LOGO from "@salesforce/contentAssetUrl/SalesWaveLogo"; ``` - `myContentAsset`—A name that refers to the asset file. - `contentAssetReference`—The name of the asset file. An asset file name can contain only underscores and alphanumeric characters, and must be unique in your org. It must begin with a letter, not include spaces, not end with an underscore, and not contain two consecutive underscores. - `namespace`—If the asset file is in a managed package, this value is the namespace of the managed package. See [Access Content Asset Files](https://developer.salesforce.com/docs/platform/lwc/create/create-content-assets.md). ## `@salesforce/i18n` Import internationalization properties from `@salesforce/i18n`. ```javascript // Syntax import internationalizationPropertyName from @salesforce/i18n/internationalizationProperty ``` ```javascript // Example import LANG from "@salesforce/i18n/lang"; ``` - `internationalizationPropertyName`—A symbol that identifies the internationalization property. - `internationalizationProperty`—An internationalization property. The internationalization properties are listed in [Access Internationalization Properties](https://developer.salesforce.com/docs/platform/lwc/create/create-i18n.md). ## `@salesforce/label` Import labels in your Salesforce organization from `@salesforce/label`. ```javascript // Syntax import labelName from "@salesforce/label/labelReference"; ``` ```javascript // Example import greeting from "@salesforce/label/c.greeting"; ``` - `labelName`—A name that refers to the label. - `labelReference`—The name of the label in your org in the format `namespace.labelName`. We use this format because it’s the same format used in managed packages, in Visualforce, and in other Salesforce technologies. You can use the same format to access labels, `myns.labelName`, regardless of where you’re accessing them. See [Access Labels](https://developer.salesforce.com/docs/platform/lwc/create/create-labels.md). ## `@salesforce/messageChannel` Import a Lightning message channel that a component can use to communicate via the Lightning Message Service. ```javascript // Syntax import channelName from "@salesforce/messageChannel/channelReference"; ``` ```javascript // Syntax for resources in a managed package import channelName from "@salesforce/messageChannel/channelName__channelReference"; ``` ```javascript // Example import SAMPLEMC from "@salesforce/messageChannel/SampleMessageChannel__c"; ``` - `channelName`—A symbol that identifies the message channel. - `channelReference`—The API name of the message channel. - `namespace`—If the message channel is in a managed package, this value is the namespace of the managed package. If the message channel is not in a managed package, do not include a namespace. See [Create a Message Channel](https://developer.salesforce.com/docs/platform/lwc/use/message-channel/use-message-channel-intro.md) ## `@salesforce/resourceUrl` Import static resources in your Salesforce organization from `@salesforce/resourceUrl`. ```javascript // Syntax import resourceName from "@salesforce/resourceUrl/resourceReference"; ``` ```javascript // Syntax for resources in a managed package import myResource from "@salesforce/resourceUrl/namespace__resourceReference"; ``` ```javascript // Example import TRAILHEAD_LOGO from "@salesforce/resourceUrl/trailhead_logo"; ``` - `myResource`—A name that refers to the static resource. - `resourceReference`—The name of the static resource. A static resource name can contain only underscores and alphanumeric characters, and must be unique in your org. It must begin with a letter, not include spaces, not end with an underscore, and not contain two consecutive underscores. - `namespace`—If the static resource is in a managed package, this value is the namespace of the managed package. See [Access Static Resources](https://developer.salesforce.com/docs/platform/lwc/create/create-resources.md). ## `@salesforce/schema` Import references to Salesforce objects and fields from `@salesforce/schema`. ```javascript // Syntax import objectName from "@salesforce/schema/objectReference"; import objectName from "@salesforce/schema/namespace__objectReference"; import fieldName from "@salesforce/schema/object.fieldReference"; ``` ```javascript // Example import POSITION_OBJECT from "@salesforce/schema/Position__c"; import POSITION_OBJECT from "@salesforce/schema/ns__Position__c"; import NAME_FIELD from "@salesforce/schema/Account.Name"; import SPANNING_FIELD from "@salesforce/schema/Account.Owner.Name"; ``` - `objectName`—A symbol that identifies the Salesforce object. - `objectReference`—The name of a Salesforce object. - `fieldName`—An imported symbol that identifies the Salesforce field. - `fieldReference`—The name of a Salesforce field. You can specify up to three **relationship fields** to reference parent objects and fields using this format: `....`. - `namespace`—If the object or field is in a managed package, this value is the namespace of the managed package. See [Import References to Salesforce Objects and Fields](https://developer.salesforce.com/docs/platform/lwc/data/data-wire-service-about.md). ## `@salesforce/site` Import the site ID of the current Experience Builder site from `@salesforce/site/Id`. ```javascript // Syntax import idName from "@salesforce/site/Id"; ``` ```javascript // Example import siteId from "@salesforce/site/Id"; ``` Import the list of active languages in your Experience Builder site from `@salesforce/site/activeLanguages`. ```javascript // Syntax import LANGUAGES from "@salesforce/site/activeLanguages"; ``` ```javascript import siteLanguages from "@salesforce/site/activeLanguages"; ``` The list of active languages in your Experience Builder site includes metadata on the default site language and all other active languages. You can configure a site’s languages in Experience Builder in **Settings** | **Languages**. Inactive languages are excluded from the list. The return value is an array of language objects, where each object includes the language’s label and the code, such as en-US. The array is sorted alphabetically by the label. See [Get Information About the Current Experience Builder Site](https://developer.salesforce.com/docs/platform/lwc/create/create-community-info.md). **important:** If a component imports `@salesforce/community` or `@salesforce/site`, it can target only an Experience Builder page. You can’t use the component in any other Salesforce container. See Configure a Component for Experience Builder. ## `@salesforce/user` Import the current user’s ID from `@salesforce/user/Id`. ```javascript // Syntax import userId from "@salesforce/user/Id"; ``` ```javascript // Example import Id from "@salesforce/user/Id"; ``` `userId`—An imported symbol that identifies the Salesforce user ID. To determine whether the user is a guest user, import the current user’s status from `@salesforce/user/isGuest`. ```javascript // Syntax import isGuestUser from "@salesforce/user/isGuest"; ``` ```javascript // Example import isGuest from "@salesforce/user/isGuest"; ``` `isGuestUser`—A symbol that identifies whether the user is a guest user (`true`) or not (`false`). See [Get Information About the Current User](https://developer.salesforce.com/docs/platform/lwc/create/get-current-user.md). ## `@salesforce/userPermission` Import a permission and check whether it’s assigned to the current user. ```javascript // Syntax import hasPermission from "@salesforce/userPermission/Permission"; ``` ```javascript // Example import { LightningElement } from 'lwc'; import hasViewSetup from '@salesforce/userPermission/ViewSetup'; export default class App extends LightingElement { get isSetupEnabled() { return hasViewSetup; } openSetup(e) {...} } ``` - `hasPermission`—A boolean indicating whether the current user has the imported permission (`true`) or not (`undefined`). - `Permission`—The name of a Salesforce user permission. See [Check Permissions](https://developer.salesforce.com/docs/platform/lwc/create/create-get-permissions.md). ## `@salesforce/customPermission` Import a custom permission and check whether it’s assigned to the current user. ```javascript // Syntax import hasPermission from '@salesforce/customPermission/Permission'; import hasPermission from '@salesforce/customPermission/namespace__Permission; ``` ```javascript // Example import { LightningElement } from "lwc"; import hasViewReport from "@salesforce/customPermission/acme__ViewReport"; export default class App extends LightingElement { get isReportVisible() { return hasViewReport; } } ``` - `hasPermission`—A boolean indicating whether the current user has the imported permission (`true`) or not (`undefined`). - `Permission`—The name of a Salesforce custom permission. See [Check Permissions](https://developer.salesforce.com/docs/platform/lwc/create/create-get-permissions.md). # Access Client Form Factor To access the form factor of the hardware the browser is running on, import the `@salesforce/client/formFactor` scoped module. ```javascript import formFactorPropertyName from "@salesforce/client/formFactor"; ``` - `formFactorPropertyName`—A name that refers to the form factor of the hardware running the browser. Possible values are: - `Large`—A desktop client. - `Medium`—A tablet client. - `Small`—A phone client. Pass the form factor to the `getRecordCreateDefaults` wire adapter to get the default layout and object information for creating a record. ```javascript import { getRecordCreateDefaults } from 'lightning/uiRecordApi'; import ACCOUNT_OBJECT from '@salesforce/schema/Account'; import FORM_FACTOR from '@salesforce/client/formFactor'; @wire(getRecordCreateDefaults, { objectApiName: ACCOUNT_OBJECT, formFactor: FORM_FACTOR}) accountDefaults; ``` **note:** You can use `@salesforce/client/formFactor` in a [TypeScript file](https://developer.salesforce.com/docs/platform/lwc/guide/ts.md). This scoped module corresponds to the `client.d.ts` type definition in the [@salesforce/lightning-types](https://www.npmjs.com/package/@salesforce/lightning-types) npm package. **See Also** - [@salesforce Modules](https://developer.salesforce.com/docs/platform/lwc/reference/reference-salesforce-modules.md) - [getRecordCreateDefaults](https://developer.salesforce.com/docs/platform/lwc/reference/wire-adapters/reference-wire-adapters-create-record-values.md) - [Configure Your Component for Different Form Factors](https://developer.salesforce.com/docs/platform/lwc/use/use-config-form-factors.md) # Access Content Asset Files Import content asset files from the `@salesforce/contentAssetUrl` scoped module. Convert a Salesforce file into a content asset file to use the file in custom apps and Experience Builder templates. ```javascript import myContentAsset from "@salesforce/contentAssetUrl/contentAssetReference"; ``` ```javascript import myContentAsset from "@salesforce/contentAssetUrl/namespace__contentAssetReference"; ``` - `myContentAsset`—A name that refers to the asset file. - `contentAssetReference`—The name of the asset file. An asset file name can contain only underscores and alphanumeric characters, and must be unique in your org. It must begin with a letter, not include spaces, not end with an underscore, and not contain two consecutive underscores. - `namespace`—If the asset file is in a managed package, this value is the namespace of the managed package. Let’s look at some sample code. The JavaScript code imports two content asset files. ```javascript // assetFileExample.js import { LightningElement } from "lwc"; import SALES_WAVE_LOGO from "@salesforce/contentAssetUrl/SalesWaveLogo"; import PARTNER_LOGOS from "@salesforce/contentAssetUrl/PartnerLogos"; export default class AssetFileExample extends LightningElement { // Expose the asset file URL for use in the template salesWaveLogoUrl = SALES_WAVE_LOGO; // Expose URL of assets included inside an archive file goldPartnerLogoUrl = PARTNER_LOGOS + "?pathinarchive=images/gold_partner.png"; } ``` A content asset file can be an archive file with a nested directory structure. To reference an item in an archive, concatenate a string to create the path to the item, as the example does to build `goldPartnerLogoUrl`. To specify the path to the content asset file in the archive, use the `pathinarchive` parameter. To reference a resource in a template, use `{property}` syntax, which is the same syntax you use to reference any JavaScript property. ```html ``` In a Salesforce DX project, asset files live in the `/force-app/main/default/contentassets` directory. You can’t create subdirectories of `contentassets`. Create an `.asset-meta` [metadata](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_contentasset.htm) file that defines the asset file. **tip:** The [lwc-recipes](https://github.com/trailheadapps/lwc-recipes) repo has a [miscContentAsset](https://github.com/trailheadapps/lwc-recipes/tree/main/force-app/main/default/lwc/miscContentAsset) component that demonstrates asset file usage. **See Also** - [_Lightning Aura Components Developer Guide_: \$ContentAsset](https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/expr_contentasset_value_provider.htm) - [_Salesforce Help_: Find and Create Asset Files in Experience Builder](https://help.salesforce.com/articleView?id=community_builder_find_create_assets.htm) - [_Salesforce Help_: View and Edit Asset Files](https://help.salesforce.com/articleView?id=files_asset_files_edit_view.htm) - [_Metadata API Developer Guide_: ContentAsset](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_contentasset.htm) - [_Object Reference_: ContentAsset](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_contentasset.htm) - [@salesforce Modules](https://developer.salesforce.com/docs/platform/lwc/reference/reference-salesforce-modules.md) # Access Elements the Component Owns To access elements rendered by a component with standard DOM APIs, use `querySelector()` with `this.template` or `this`. To locate elements in the DOM without a selector, use refs. **important:** Don’t use the `window` or `document` global properties to query for DOM elements. See [DOM Access Containment](/docs/platform/lightning-components-security/guide/locker-dom.html). Also, we don’t recommend using JavaScript to manipulate the DOM unless you're working with a [third-party library via `lightning/platformResourceLoader`](https://developer.salesforce.com/docs/platform/lwc/js/js-third-party-library.md). It's better to use the Lightning Web Components [HTML directives](https://developer.salesforce.com/docs/platform/lwc/reference/reference-directives.md) to write declarative code. ## querySelector() The standard way to access elements in the DOM is to use `querySelector()`. To locate shadow DOM nodes, use `querySelector()` or `querySelectorAll()` on `this.template`. For light DOM nodes, use one of those methods on `this`. ```javascript // shadow DOM this.template.querySelector("div"); // light DOM this.querySelector("div"); ``` **note:** You can also use `{element}.template.querySelector`. Use these methods to look for the elements that your component rendered. - The order of elements is not guaranteed. - Elements not rendered to the DOM aren’t returned in the `querySelector` result. - Don’t use ID selectors with `querySelector`. The IDs that you define in HTML templates may be transformed into globally unique values when the template is rendered. If you use an ID selector in JavaScript, it won’t match the transformed ID. - For light DOM components, `this.querySelector()` searches through elements outside of the immediate template, such as light DOM children. Use a more specific selector to narrow the scope of the method. - If the component runs in an org with Lightning Locker enabled, be aware of a [potential memory leak](/docs/platform/lightning-components-security/guide/locker-queryselector.html). If possible, the org should [enable Lightning Web Security (LWS)](/docs/platform/lightning-components-security/guide/lws-enable.html). Alternatively, consider using refs instead of `querySelector`. - Place light DOM components within a shadow DOM component. Lightning Locker and LWS don’t support light DOM components outside shadow DOM. ```html ``` ```javascript // example.js import { LightningElement } from "lwc"; export default class Example extends LightningElement { renderedCallback() { this.template.querySelector("div"); //
First
this.template.querySelector("span"); // null this.template.querySelectorAll("div"); // [
First
,
Second
] } } ``` **tip:** The [lwc-recipes](https://github.com/trailheadapps/lwc-recipes) repo has a [miscDomQuery](https://github.com/trailheadapps/lwc-recipes/tree/main/force-app/main/default/lwc/miscDomQuery) component that demonstrates DOM querying using `querySelectorAll`. ## Refs Refs locate DOM elements without a selector and only query elements contained in a specified template. First, add the `lwc:ref` directive to your element and assign it a value. To call that reference, use `this.refs`. In this example, the `
` element has the directive `lwc:ref="myDiv"`, which `this.refs` references to access the `
` at runtime. ```html ``` ```javascript export default class extends LightningElement { renderedCallback() { console.log(this.refs.myDiv); } } ``` ### Considerations You must define the directive `lwc:ref` before calling `this.refs`. If you call `this.refs` for a nonexistent ref, it returns `undefined`. If the template contains duplicate `lwc:ref` directives, `this.refs` references the last `
`. ```html ``` `this.refs` is a plain, read-only object. Trying to add, modify, or delete properties from within its component causes a runtime error. Its key is a string, and its value is a DOM element. The syntax for `this.refs` is the same for referencing elements in light DOM and shadow DOM. Refs are configurable and writable, so refs defined in a component overwrite those from `LightningElement.prototype`. You can’t apply `lwc:ref` to `