@antelopejs/interface-core
这个软件包持有每个"羚羊"JS接口所建的原始人. 它提供跨越模块边界,装饰工厂,模块生命周期事件,结构化伐木,以及项目配置的代理.
它提供的东西
InterfaceFunction宣布合同职能.ImplementInterface将模块的操作附加到其中, 由InterfaceToImpl。在执行之前发出的呼吁排队等待.AsyncProxy, (中文(简体) ),EventProxy财务报告和审定财务报表RegisteringProxy搭载模块之间的呼叫、事件和登记,以及模块卸下时的拆卸.@antelopejs/interface-core/decorators构建打入的类,方法,属性和参数的装饰.@antelopejs/interface-core/modules暴露出生命周期事件和模块管理功能.@antelopejs/interface-core/logging在命名的频道上写入结构化日志 .@antelopejs/interface-core/config提供defineConfig页:1antelope.config.ts。 。 。 .
执行情况
| 模块 | 页:1 |
|---|---|
@antelopejs/core | 羚羊JS运行时间和 ajs CLI 执行此接口 |
安装
将软件包添加到每个宣布或执行接口的模块:
pnpm add @antelopejs/interface-core
你不需要额外的模块,因为 @antelopejs/core 提供执行.
快开始
宣告合同:
// src/interface/index.ts
import { InterfaceFunction } from "@antelopejs/interface-core";
export const GetGreeting = InterfaceFunction<(name: string) => string>();
执行并调用模块:
// src/index.ts
import { ImplementInterface } from "@antelopejs/interface-core";
import { Logging } from "@antelopejs/interface-core/logging";
import * as Greeting from "./interface";
export function construct() {
ImplementInterface(Greeting, {
GetGreeting: (name: string) => `Hello, ${name}`,
});
}
export async function start() {
Logging.Info(await Greeting.GetGreeting("Ada"));
}
接口函数总是返回一个承诺,即使执行是同步的.
文档
兼容性
@antelopejs/core 执行此软件包。 每一份核心发布声明 @antelopejs/interface-core 范围 dependencies 联 合 国 package.json。 。 。 .
捐款
读取 捐款额 在你打开拉动请求之前。 当地检查为:
pnpm install
pnpm lint
pnpm test