mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix documentation
Signed-off-by: Juho Heikka <juho.heikka@gmail.com>
This commit is contained in:
parent
a1035a9cba
commit
a063d28930
@ -79,6 +79,8 @@ Note that pages are associated with the [`Renderer.LensExtension`](renderer-exte
|
|||||||
The following example demonstrates how an application menu can be used to navigate to such a page:
|
The following example demonstrates how an application menu can be used to navigate to such a page:
|
||||||
|
|
||||||
``` typescript
|
``` typescript
|
||||||
|
import { Main } from "@k8slens/extensions";
|
||||||
|
|
||||||
export default class SamplePageMainExtension extends Main.LensExtension {
|
export default class SamplePageMainExtension extends Main.LensExtension {
|
||||||
appMenus = [
|
appMenus = [
|
||||||
{
|
{
|
||||||
@ -95,14 +97,14 @@ This page would be defined in your extension's `Renderer.LensExtension` implemen
|
|||||||
|
|
||||||
### `trayMenus`
|
### `trayMenus`
|
||||||
|
|
||||||
`trayMenus` is a similar than appMenus, but you don't add parentId since all of the tray menus under Lens tray icon. It's an array of Electron's [`MenuItemConstructorOptions`](https://www.electronjs.org/docs/v14-x-y/api/menu-item). Most importantly you can define a `label` and a `click` handler.
|
`trayMenus` is an array of Electron's [`MenuItemConstructorOptions`](https://www.electronjs.org/docs/v14-x-y/api/menu-item). Most importantly you can define a `label` and a `click` handler.
|
||||||
|
|
||||||
The following example demonstrates how tray menus can be added from extension:
|
The following example demonstrates how tray menus can be added from extension:
|
||||||
|
|
||||||
``` typescript
|
``` typescript
|
||||||
import { Main } from "@k8slens/extensions";
|
import { Main } from "@k8slens/extensions";
|
||||||
|
|
||||||
export default class SamplePageMainExtension extends Main.LensExtension {
|
export default class SampleTrayMenuMainExtension extends Main.LensExtension {
|
||||||
trayMenus = [{
|
trayMenus = [{
|
||||||
label: "menu from the extension",
|
label: "menu from the extension",
|
||||||
click: () => { console.log("tray menu clicked!") }
|
click: () => { console.log("tray menu clicked!") }
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user