MCPcopy
hub / github.com/lit/lit / LocalizeController

Class LocalizeController

packages/localize/src/internal/localized-controller.ts:11–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9import type {ReactiveController, ReactiveControllerHost} from 'lit';
10
11class LocalizeController implements ReactiveController {
12 host: ReactiveControllerHost;
13
14 constructor(host: ReactiveControllerHost) {
15 this.host = host;
16 }
17
18 private readonly __litLocalizeEventHandler = (
19 event: WindowEventMap[typeof LOCALE_STATUS_EVENT]
20 ) => {
21 if (event.detail.status === 'ready') {
22 this.host.requestUpdate();
23 }
24 };
25
26 hostConnected() {
27 window.addEventListener(
28 LOCALE_STATUS_EVENT,
29 this.__litLocalizeEventHandler
30 );
31 }
32
33 hostDisconnected() {
34 window.removeEventListener(
35 LOCALE_STATUS_EVENT,
36 this.__litLocalizeEventHandler
37 );
38 }
39}
40
41/**
42 * Re-render the given LitElement whenever a new active locale has loaded.

Callers

nothing calls this directly

Calls 1

requestUpdateMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…