【文件属性】:
文件名称:proxy-object-method:对象方法的后方或前缀代理util
文件大小:5KB
文件格式:ZIP
更新时间:2021-04-13 11:05:37
JavaScript
代理对象方法
对象方法的后方或前缀代理util
特征
为对象中的任何方法添加前缀/后方逻辑的便宜方法
逐链记录逻辑
以并发方式执行前缀/后方逻辑
自定义定义何时执行前缀/后逻辑
全部按承诺执行
用法
基本用法
const ProxyObjMethod = require ( 'proxy-object-method' ) ;
const target = {
main ( ... args ) {
console . log ( `main args: ${ args . slice ( 0 , - 1 ) } ret: ${ JSON . stringify ( args [ args . length - 1 ] ) } ` )
return true ;
}
}
const newTarget = new ProxyObjMethod ( target )
【文件预览】:
proxy-object-method-main
----README.md(4KB)
----LICENSE(1KB)
----package.json(620B)
----index.js(4KB)
----test.js(3KB)