custom-decorators
Advanced tools
Comparing version 0.0.1 to 0.0.2
{ | ||
"name": "custom-decorators", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "", | ||
@@ -19,3 +19,3 @@ "type": "module", | ||
"author": "", | ||
"license": "ISC" | ||
"license": "MIT" | ||
} |
@@ -11,3 +11,3 @@ | ||
```js | ||
import custom from '@ali/custom'; | ||
import custom from 'custom-decorators'; | ||
@@ -42,1 +42,28 @@ class ClassA { | ||
# Features | ||
* 支持同步 | ||
```js | ||
class ClassA { | ||
@custom('ClassA.method', { sync: true }) | ||
method(name) { | ||
console.log(`hello ${name}`); | ||
} | ||
} | ||
// 注意插件函数也需要是同步,不要添加 async 关键字 | ||
custom('ClassA.method', function(context, next) { | ||
const { args } = context; | ||
console.log(this, 'before', args[0]); | ||
next(); | ||
console.log(this, 'after', args[0]); | ||
}) | ||
``` | ||
# Limit | ||
* 仅支持标准 JS 写法, 不支持 TS 写法 |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15058
68
419