Demo

PluginAPI

Plugin အချင်းချင်း အသုံးပြုနိုင်သော registry ဖြစ်ပြီး read-only ကာကွယ်မှု ပါရှိပါသည်။ Frontend export.ts wrapper များနှင့် တွဲသုံးပါ — Core အောက်ရှိ Export & expose APIs ကို ကြည့်ပါ။

PluginAPI

Plugin အချင်းချင်း အသုံးပြုနိုင်သော registry ဖြစ်ပြီး read-only ကာကွယ်မှု ပါရှိပါသည်။ Frontend export.ts wrapper များနှင့် တွဲသုံးပါ — Core အောက်ရှိ Export & expose APIs ကို ကြည့်ပါ။

  • Methods: expose(plugin, name, value), use(plugin, name), debug()
  • အစစ်အမှန် implementation များကို register() တွင် expose လုပ်ပါ — အသုံးပြုသူများက use() သို့မဟုတ် ထုတ်ပြန်ထားသော wrapper များကို ခေါ်ပါသည်
TSXprovider — expose in register()
1import { PluginAPI } from "@quan-erp/shared-frontend-core"; 2import type { AppRegistryState, PluginModule } from "@quan-erp/shared-types"; 3import metadata from "../module.metadata.json" with { type: "json" }; 4import { ProductDropdown } from "./page/product/product-dropdown"; 5 6const Plugin: PluginModule = { 7 register(_AppRegistry: AppRegistryState) { 8 PluginAPI.expose( 9 metadata.name, 10 "product-dropdown", 11 ProductDropdown, // real implementation — not a PluginAPI.use wrapper 12 ); 13 }, 14}; 15 16export default Plugin;
TSXconsumer — use / debug
1import { PluginAPI } from "@quan-erp/shared-frontend-core"; 2 3const ProductDropdown = PluginAPI.use("products", "product-dropdown"); 4 5export function OrderForm() { 6 return <ProductDropdown value={null} setValue={() => {}} />; 7} 8 9// Optional: inspect registry while developing 10PluginAPI.debug();