@nweb/core
Advanced tools
@@ -69,9 +69,9 @@ export declare function Readonly(target: any, property: any, descriptor: any): any; | ||
| private readonly scope; | ||
| private readonly aspect; | ||
| private readonly handle; | ||
| private component; | ||
| constructor(type: AspectType, pattern: string | RegExp, scope: AspectScope, aspect: string); | ||
| constructor(type: AspectType, pattern: string | RegExp, scope: AspectScope, handle: string); | ||
| bind(component: any): void; | ||
| match(component: any, method: string): boolean; | ||
| before(target: any, method: string, args: any[]): Promise<boolean>; | ||
| after(target: any, method: string, args: any[], result: any): Promise<void>; | ||
| before(target: any, method: string, args: any[]): any; | ||
| after(target: any, method: string, args: any[], result: any): void; | ||
| } | ||
@@ -78,0 +78,0 @@ export declare function Aspect(point: { |
@@ -219,9 +219,9 @@ "use strict"; | ||
| scope; | ||
| aspect; | ||
| handle; | ||
| component; | ||
| constructor(type, pattern, scope, aspect) { | ||
| constructor(type, pattern, scope, handle) { | ||
| this.type = type; | ||
| this.pattern = typeof pattern === 'string' ? new RegExp(pattern.replace(/\*/g, '.*')) : pattern; | ||
| this.scope = scope; | ||
| this.aspect = aspect; | ||
| this.handle = handle; | ||
| } | ||
@@ -240,11 +240,10 @@ bind(component) { | ||
| } | ||
| async before(target, method, args) { | ||
| before(target, method, args) { | ||
| if (this.type === 'before') { | ||
| const rs = await this.component[this.aspect]?.call(target, method, args); | ||
| return rs !== false; | ||
| return this.component[this.handle]?.call(target, method, args); | ||
| } | ||
| } | ||
| async after(target, method, args, result) { | ||
| after(target, method, args, result) { | ||
| if (this.type === 'after') { | ||
| return this.component[this.aspect]?.call(target, method, args, result); | ||
| this.component[this.handle]?.call(target, method, args, result); | ||
| } | ||
@@ -251,0 +250,0 @@ } |
+1
-1
| { | ||
| "name": "@nweb/core", | ||
| "version": "1.1.9", | ||
| "version": "1.1.10", | ||
| "description": "web核心组件", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index", |
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
145879
-0.06%4233
-0.02%