0.6.0-alpha.3 • Published 21 days ago

srm-resource-detection v0.6.0-alpha.3

Weekly downloads
-
License
-
Repository
-
Last release
21 days ago

Resource Detection

对于各种资源的检测,包括但不限于模型、图片、骨骼动画等

环境准备

  • Node.js >= 10.0.0

本地开发

# 1. 安装依赖(首次)
npm install
# 2. 开发
npm run dev

测试

npm run test

发布

npm publish

备注

外部检测项注册

目前检测分为四类,每一类都可以单独注册,也可以混合起来一起注册,下面以模型检测注册为例

class Test extends ModelDetection{
    //报告文本,方法中可以为空
    protected getReport(ruleItem: IValidateResult, report: ReportType): void {
        throw new Error("Method not implemented.");
    }
    //检测方法 和异步检测方法二选一
    protected getValidate(): IValidateResult[] | null {
        throw new Error("Method not implemented.");
    }
    //异步检测方法
    protected getValidateAsync(): Promise<IValidateResult[] | null> {
        throw new Error("Method not implemented.");
    }
}
//第二种注册方式——通过allocationDetectionType()方法自动通过检测类型注册
allocationDetectionType({ registerName:'test', registerType:DetectionType.Model },Test);
//第三种注册方式(特定种类)——通过不同类型的入口类就行本类型的检测注册
const modelIO = new ModelIO();
modelIO.registerModelDetection('test',Test);