diff --git a/packages/x-components/src/composables/index.ts b/packages/x-components/src/composables/index.ts index 633617057e..1130f30636 100644 --- a/packages/x-components/src/composables/index.ts +++ b/packages/x-components/src/composables/index.ts @@ -1,3 +1,4 @@ export * from './create-use-device.composable'; export * from './use-$x'; +export * from './use-register-x-module'; export * from './use-on-display'; diff --git a/packages/x-components/src/composables/use-register-x-module.ts b/packages/x-components/src/composables/use-register-x-module.ts new file mode 100644 index 0000000000..41bfc0b665 --- /dev/null +++ b/packages/x-components/src/composables/use-register-x-module.ts @@ -0,0 +1,14 @@ +import { AnyXModule } from '../x-modules/x-modules.types'; +import { XPlugin } from '../plugins/x-plugin'; +/** + * Initializes a component as an X-Component: + * * Registers the module passed as parameter. + * * Flags the component as X-Component, so then it can be detected with the {@link isXComponent} + * function. + * + * @param module - The module associated to the X-Component that is being registered. + * @public + */ +export function useRegisterXModule(module: AnyXModule): void { + XPlugin.registerXModule(module); +}