Commit 1474b71d authored by nanahira's avatar nanahira

change classification

parent a13fa723
import { defaultRegistrar } from '../registrar';
export const { Isolate, UsingService } = defaultRegistrar.scopeDecorators();
export const { Isolate, UsingService, If, For } =
defaultRegistrar.scopeDecorators();
export const { UsePlugin, Apply } = defaultRegistrar.methodDecorators();
......@@ -5,8 +5,6 @@ import { PluginRegistrar } from '../plugin-def';
const pluginDecorators = defaultRegistrar.pluginDecorators();
export const {
If,
For,
PluginName,
PluginSchema,
Reusable,
......
......@@ -453,6 +453,24 @@ export class Registrar<Ctx extends Context> {
scopeDecorators() {
return {
If: <T>(
func: Condition<boolean, T, [Record<string, any>]>,
): MethodDecorator =>
this.metadata.append('CordisControl', {
type: 'if',
condition: func,
}),
For: <T>(
func: Condition<
Iterable<Record<string, any>>,
T,
[Record<string, any>]
>,
): MethodDecorator =>
this.metadata.append('CordisControl', {
type: 'for',
condition: func,
}),
Isolate: (...services: string[]) =>
this.decorateTransformer((ctx, r) => ctx.isolate(r(services))),
UsingService: (
......@@ -488,24 +506,6 @@ export class Registrar<Ctx extends Context> {
this.metadata.set('CordisPluginReusable', reusable),
Fork: (fork: PluginRegistrar.PluginClass<Ctx>) =>
this.metadata.set('CordisPluginFork', fork),
If: <T>(
func: Condition<boolean, T, [Record<string, any>]>,
): MethodDecorator =>
this.metadata.append('CordisControl', {
type: 'if',
condition: func,
}),
For: <T>(
func: Condition<
Iterable<Record<string, any>>,
T,
[Record<string, any>]
>,
): MethodDecorator =>
this.metadata.append('CordisControl', {
type: 'for',
condition: func,
}),
Provide: (
name: string,
options?: Registrar.ProvideOptions,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment