mirror of https://github.com/halo-dev/halo-admin
22 lines
554 B
TypeScript
22 lines
554 B
TypeScript
import { usePluginStore } from "@/stores/plugin";
|
|
import type {
|
|
ExtensionPointName,
|
|
ExtensionPointState,
|
|
} from "@halo-dev/admin-shared";
|
|
import type { Plugin } from "@/types/extension";
|
|
import type { Ref } from "vue";
|
|
|
|
export function useExtensionPointsState(
|
|
point: ExtensionPointName,
|
|
state: Ref<ExtensionPointState>
|
|
) {
|
|
const { plugins } = usePluginStore();
|
|
|
|
plugins.forEach((plugin: Plugin) => {
|
|
if (!plugin.spec.module?.extensionPoints?.[point]) {
|
|
return;
|
|
}
|
|
plugin.spec.module.extensionPoints[point]?.(state);
|
|
});
|
|
}
|