Commit 023bc80b authored by nanahira's avatar nanahira

add Apply

parent b5ec6d81
...@@ -95,6 +95,7 @@ export function UseCommand( ...@@ -95,6 +95,7 @@ export function UseCommand(
export const UseFormatter = (name: string) => DoRegister.formatter(name); export const UseFormatter = (name: string) => DoRegister.formatter(name);
export const UsePreset = (name: string) => DoRegister.preset(name); export const UsePreset = (name: string) => DoRegister.preset(name);
export const UseInterval = (interval: number) => DoRegister.interval(interval); export const UseInterval = (interval: number) => DoRegister.interval(interval);
export const Apply = () => DoRegister.apply();
// Context scopes // Context scopes
......
...@@ -80,6 +80,7 @@ export namespace DoRegister { ...@@ -80,6 +80,7 @@ export namespace DoRegister {
formatter: string; formatter: string;
preset: string; preset: string;
interval: number; interval: number;
apply: void;
} }
export interface DecoratorMap { export interface DecoratorMap {
...@@ -92,6 +93,7 @@ export namespace DoRegister { ...@@ -92,6 +93,7 @@ export namespace DoRegister {
ws(socket: WebSocket, request: IncomingMessage): any; ws(socket: WebSocket, request: IncomingMessage): any;
formatter: I18n.Formatter; formatter: I18n.Formatter;
preset: I18n.Renderer; preset: I18n.Renderer;
apply: Awaitable<any>;
} }
export type Config<K extends keyof ConfigMap = keyof ConfigMap> = export type Config<K extends keyof ConfigMap = keyof ConfigMap> =
...@@ -235,4 +237,8 @@ export namespace DoRegister { ...@@ -235,4 +237,8 @@ export namespace DoRegister {
export const interval = registry.define('interval', (data, ctx, obj, key) => { export const interval = registry.define('interval', (data, ctx, obj, key) => {
ctx.setInterval((...args) => obj[key](...args), data); ctx.setInterval((...args) => obj[key](...args), data);
}); });
export const apply = registry.define('apply', (data, ctx, obj, key) => {
return obj[key]();
});
} }
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