import { computed , makeObservable } from 'mobx' ; import type { IMenuItem , IMenuPanel } from '../IMenuPanel' ; export interface IComputedMenuPanelOptions { id : string ; menuItemsGetter : ( ) => IMenuItem [ ] ; } export class ComputedMenuPanelModel implements IMenuPanel { id : string ; get menuItems ( ) { return this . options . menuItemsGetter ( ) ; } constructor ( private options ) { makeObservable ( this , { menuItems : computed , } ) ; this . id = this . options . id ; } }