|
| 1 | +// Copyright (c) Meta Platforms, Inc. and affiliates. |
| 2 | +// Copyright 2024 The Chromium Authors. All rights reserved. |
| 3 | +// Use of this source code is governed by a BSD-style license that can be |
| 4 | +// found in the LICENSE file. |
| 5 | + |
| 6 | +import * as i18n from '../../core/i18n/i18n.js'; |
| 7 | +import * as UI from '../../ui/legacy/legacy.js'; |
| 8 | +import type * as Livemate from './livemate.js'; |
| 9 | + |
| 10 | +const UIStrings = { |
| 11 | + /** |
| 12 | + *@description Title of the Livemate panel |
| 13 | + */ |
| 14 | + livemate: 'Livemate', |
| 15 | + /** |
| 16 | + *@description Command for showing the Livemate panel |
| 17 | + */ |
| 18 | + showLivemate: 'Show Livemate', |
| 19 | +} as const; |
| 20 | + |
| 21 | +const str_ = i18n.i18n.registerUIStrings('panels/livemate/livemate-meta.ts', UIStrings); |
| 22 | +const i18nLazyString = i18n.i18n.getLazilyComputedLocalizedString.bind(undefined, str_); |
| 23 | + |
| 24 | +let loadedLivemateModule: (typeof Livemate | undefined); |
| 25 | + |
| 26 | +async function loadLivemateModule(): Promise<typeof Livemate> { |
| 27 | + if (!loadedLivemateModule) { |
| 28 | + loadedLivemateModule = await import('./livemate.js'); |
| 29 | + } |
| 30 | + return loadedLivemateModule; |
| 31 | +} |
| 32 | + |
| 33 | +UI.ViewManager.registerViewExtension({ |
| 34 | + location: UI.ViewManager.ViewLocationValues.PANEL, |
| 35 | + id: 'livemate', |
| 36 | + title: i18nLazyString(UIStrings.livemate), |
| 37 | + commandPrompt: i18nLazyString(UIStrings.showLivemate), |
| 38 | + order: 100, |
| 39 | + async loadView() { |
| 40 | + const Livemate = await loadLivemateModule(); |
| 41 | + return Livemate.LivematePanel.LivematePanel.instance(); |
| 42 | + }, |
| 43 | +}); |
0 commit comments