UNPKG

apphouse

Version:

Component library for React that uses observable state management and theme-able components.

23 lines (19 loc) 525 B
import { makeAutoObservable } from 'mobx'; import { TabViewModel, UITabView } from './TabViewModel'; /** * This is the main class to handle tabs in the app. * An app will have many tabs */ export class TabsModel { tabViews: Record<string, TabViewModel>; constructor() { this.tabViews = {}; makeAutoObservable(this); } get = (tabId: string): TabViewModel | undefined => { return this.tabViews[tabId]; }; createTab = (tab: UITabView) => { this.tabViews[tab.id] = new TabViewModel(tab); }; }