nemo-observable-util
Advanced tools
Comparing version 5.3.0 to 5.3.1
@@ -138,10 +138,15 @@ 'use strict'; | ||
// 不自定义 name 的 | ||
return functionWrapperFn(target); | ||
return functionWrapperFn(target, target.name); | ||
} | ||
// #endregion | ||
var names = [ | ||
// propertyName | ||
propertyKey, | ||
// className | ||
target.constructor && target.constructor.name]; | ||
// #region 三个参数:当 MethodDecorator 使用 | ||
if (descriptor && typeof descriptor.value === 'function') { | ||
// 一定是 decorator 打在 class method 上,直接包裹 | ||
descriptor.value = functionWrapperFn(descriptor.value); | ||
descriptor.value = functionWrapperFn.apply(void 0, [ descriptor.value ].concat( names )); | ||
return; | ||
@@ -151,3 +156,3 @@ } | ||
// #region 两个参数:当 PropertyDecorator 使用 | ||
// #region 两个参数, 并且从入参 target 即原型链上能获取到,说明是当 Getter Setter Decorator 使用 | ||
var v = Object.getOwnPropertyDescriptor(target, propertyKey); | ||
@@ -159,3 +164,3 @@ if (v) { | ||
var obj; | ||
v.get = functionWrapperFn(v.get); | ||
v.get = functionWrapperFn.apply(void 0, [ v.get ].concat( names )); | ||
} | ||
@@ -165,3 +170,3 @@ if ('set' in v && v.set !== undefined) { | ||
var obj$1; | ||
v.set = functionWrapperFn(v.set); | ||
v.set = functionWrapperFn.apply(void 0, [ v.set ].concat( names )); | ||
} | ||
@@ -171,3 +176,5 @@ // getOwnPropertyDescriptor 拿到的东西直接修改无用,这里 return 新的交给 ts decorator 帮我们替换 | ||
} | ||
// 一定是 decorator 打在 class property 上 | ||
// #endregion | ||
// #region 两个参数, 并且从入参 target 即原型链上不能获取到,说明是当 PropertyDecorator 使用 | ||
var internalPropertyKey = Symbol(propertyKey); | ||
@@ -180,3 +187,3 @@ Object.defineProperty(target, propertyKey, { | ||
// 如果属性值是函数,包裹一下,否则不处理 | ||
value = typeof value === 'function' ? functionWrapperFn(value) : value; | ||
value = typeof value === 'function' ? functionWrapperFn.apply(void 0, [ value ].concat( names )) : value; | ||
// 对这个属性的初始值赋值过程也包裹一下 | ||
@@ -199,2 +206,6 @@ propertyInitWrapperFn(function () { | ||
function joinName(restNames) { | ||
return restNames.filter(function (i) { return !!i; }).reverse().join(':'); | ||
} | ||
var RunnerManager = function RunnerManager() { | ||
@@ -298,3 +309,3 @@ var this$1 = this; | ||
enumerable: false, | ||
value: restNames.join('') | ||
value: joinName(restNames) | ||
}); | ||
@@ -350,3 +361,3 @@ } | ||
enumerable: false, | ||
value: restNames.join() | ||
value: joinName(restNames) | ||
}); | ||
@@ -386,3 +397,4 @@ } | ||
} | ||
var identity = transactionManager.getUUID(restNames.join('')); | ||
var name = joinName(restNames); | ||
var identity = transactionManager.getUUID(name); | ||
function wrapper() { | ||
@@ -404,3 +416,3 @@ var args = [], len = arguments.length; | ||
enumerable: false, | ||
value: restNames.join('') | ||
value: name | ||
}); | ||
@@ -407,0 +419,0 @@ } |
@@ -115,10 +115,15 @@ 'use strict'; | ||
// 不自定义 name 的 | ||
return functionWrapperFn(target); | ||
return functionWrapperFn(target, target.name); | ||
} | ||
// #endregion | ||
const names = [ | ||
// propertyName | ||
propertyKey, | ||
// className | ||
target.constructor && target.constructor.name]; | ||
// #region 三个参数:当 MethodDecorator 使用 | ||
if (descriptor && typeof descriptor.value === 'function') { | ||
// 一定是 decorator 打在 class method 上,直接包裹 | ||
descriptor.value = functionWrapperFn(descriptor.value); | ||
descriptor.value = functionWrapperFn(descriptor.value, ...names); | ||
return; | ||
@@ -128,3 +133,3 @@ } | ||
// #region 两个参数:当 PropertyDecorator 使用 | ||
// #region 两个参数, 并且从入参 target 即原型链上能获取到,说明是当 Getter Setter Decorator 使用 | ||
const v = Object.getOwnPropertyDescriptor(target, propertyKey); | ||
@@ -137,3 +142,3 @@ if (v) { | ||
}); | ||
v.get = functionWrapperFn(v.get); | ||
v.get = functionWrapperFn(v.get, ...names); | ||
} | ||
@@ -144,3 +149,3 @@ if ('set' in v && v.set !== undefined) { | ||
}); | ||
v.set = functionWrapperFn(v.set); | ||
v.set = functionWrapperFn(v.set, ...names); | ||
} | ||
@@ -150,3 +155,5 @@ // getOwnPropertyDescriptor 拿到的东西直接修改无用,这里 return 新的交给 ts decorator 帮我们替换 | ||
} | ||
// 一定是 decorator 打在 class property 上 | ||
// #endregion | ||
// #region 两个参数, 并且从入参 target 即原型链上不能获取到,说明是当 PropertyDecorator 使用 | ||
const internalPropertyKey = Symbol(propertyKey); | ||
@@ -157,3 +164,3 @@ Object.defineProperty(target, propertyKey, { | ||
// 如果属性值是函数,包裹一下,否则不处理 | ||
value = typeof value === 'function' ? functionWrapperFn(value) : value; | ||
value = typeof value === 'function' ? functionWrapperFn(value, ...names) : value; | ||
// 对这个属性的初始值赋值过程也包裹一下 | ||
@@ -176,2 +183,6 @@ propertyInitWrapperFn(() => { | ||
function joinName(restNames) { | ||
return restNames.filter(i => !!i).reverse().join(':'); | ||
} | ||
class RunnerManager { | ||
@@ -263,3 +274,3 @@ constructor() { | ||
enumerable: false, | ||
value: restNames.join('') | ||
value: joinName(restNames) | ||
}); | ||
@@ -309,3 +320,3 @@ } | ||
enumerable: false, | ||
value: restNames.join() | ||
value: joinName(restNames) | ||
}); | ||
@@ -342,3 +353,4 @@ } | ||
} | ||
const identity = transactionManager.getUUID(restNames.join('')); | ||
const name = joinName(restNames); | ||
const identity = transactionManager.getUUID(name); | ||
function wrapper(...args) { | ||
@@ -357,3 +369,3 @@ transactionManager.start(identity); | ||
enumerable: false, | ||
value: restNames.join('') | ||
value: name | ||
}); | ||
@@ -360,0 +372,0 @@ } |
@@ -134,10 +134,15 @@ var connectionStore = new WeakMap(); | ||
// 不自定义 name 的 | ||
return functionWrapperFn(target); | ||
return functionWrapperFn(target, target.name); | ||
} | ||
// #endregion | ||
var names = [ | ||
// propertyName | ||
propertyKey, | ||
// className | ||
target.constructor && target.constructor.name]; | ||
// #region 三个参数:当 MethodDecorator 使用 | ||
if (descriptor && typeof descriptor.value === 'function') { | ||
// 一定是 decorator 打在 class method 上,直接包裹 | ||
descriptor.value = functionWrapperFn(descriptor.value); | ||
descriptor.value = functionWrapperFn.apply(void 0, [ descriptor.value ].concat( names )); | ||
return; | ||
@@ -147,3 +152,3 @@ } | ||
// #region 两个参数:当 PropertyDecorator 使用 | ||
// #region 两个参数, 并且从入参 target 即原型链上能获取到,说明是当 Getter Setter Decorator 使用 | ||
var v = Object.getOwnPropertyDescriptor(target, propertyKey); | ||
@@ -155,3 +160,3 @@ if (v) { | ||
var obj; | ||
v.get = functionWrapperFn(v.get); | ||
v.get = functionWrapperFn.apply(void 0, [ v.get ].concat( names )); | ||
} | ||
@@ -161,3 +166,3 @@ if ('set' in v && v.set !== undefined) { | ||
var obj$1; | ||
v.set = functionWrapperFn(v.set); | ||
v.set = functionWrapperFn.apply(void 0, [ v.set ].concat( names )); | ||
} | ||
@@ -167,3 +172,5 @@ // getOwnPropertyDescriptor 拿到的东西直接修改无用,这里 return 新的交给 ts decorator 帮我们替换 | ||
} | ||
// 一定是 decorator 打在 class property 上 | ||
// #endregion | ||
// #region 两个参数, 并且从入参 target 即原型链上不能获取到,说明是当 PropertyDecorator 使用 | ||
var internalPropertyKey = Symbol(propertyKey); | ||
@@ -176,3 +183,3 @@ Object.defineProperty(target, propertyKey, { | ||
// 如果属性值是函数,包裹一下,否则不处理 | ||
value = typeof value === 'function' ? functionWrapperFn(value) : value; | ||
value = typeof value === 'function' ? functionWrapperFn.apply(void 0, [ value ].concat( names )) : value; | ||
// 对这个属性的初始值赋值过程也包裹一下 | ||
@@ -195,2 +202,6 @@ propertyInitWrapperFn(function () { | ||
function joinName(restNames) { | ||
return restNames.filter(function (i) { return !!i; }).reverse().join(':'); | ||
} | ||
var RunnerManager = function RunnerManager() { | ||
@@ -294,3 +305,3 @@ var this$1 = this; | ||
enumerable: false, | ||
value: restNames.join('') | ||
value: joinName(restNames) | ||
}); | ||
@@ -346,3 +357,3 @@ } | ||
enumerable: false, | ||
value: restNames.join() | ||
value: joinName(restNames) | ||
}); | ||
@@ -382,3 +393,4 @@ } | ||
} | ||
var identity = transactionManager.getUUID(restNames.join('')); | ||
var name = joinName(restNames); | ||
var identity = transactionManager.getUUID(name); | ||
function wrapper() { | ||
@@ -400,3 +412,3 @@ var args = [], len = arguments.length; | ||
enumerable: false, | ||
value: restNames.join('') | ||
value: name | ||
}); | ||
@@ -403,0 +415,0 @@ } |
@@ -111,10 +111,15 @@ const connectionStore = new WeakMap(); | ||
// 不自定义 name 的 | ||
return functionWrapperFn(target); | ||
return functionWrapperFn(target, target.name); | ||
} | ||
// #endregion | ||
const names = [ | ||
// propertyName | ||
propertyKey, | ||
// className | ||
target.constructor && target.constructor.name]; | ||
// #region 三个参数:当 MethodDecorator 使用 | ||
if (descriptor && typeof descriptor.value === 'function') { | ||
// 一定是 decorator 打在 class method 上,直接包裹 | ||
descriptor.value = functionWrapperFn(descriptor.value); | ||
descriptor.value = functionWrapperFn(descriptor.value, ...names); | ||
return; | ||
@@ -124,3 +129,3 @@ } | ||
// #region 两个参数:当 PropertyDecorator 使用 | ||
// #region 两个参数, 并且从入参 target 即原型链上能获取到,说明是当 Getter Setter Decorator 使用 | ||
const v = Object.getOwnPropertyDescriptor(target, propertyKey); | ||
@@ -133,3 +138,3 @@ if (v) { | ||
}); | ||
v.get = functionWrapperFn(v.get); | ||
v.get = functionWrapperFn(v.get, ...names); | ||
} | ||
@@ -140,3 +145,3 @@ if ('set' in v && v.set !== undefined) { | ||
}); | ||
v.set = functionWrapperFn(v.set); | ||
v.set = functionWrapperFn(v.set, ...names); | ||
} | ||
@@ -146,3 +151,5 @@ // getOwnPropertyDescriptor 拿到的东西直接修改无用,这里 return 新的交给 ts decorator 帮我们替换 | ||
} | ||
// 一定是 decorator 打在 class property 上 | ||
// #endregion | ||
// #region 两个参数, 并且从入参 target 即原型链上不能获取到,说明是当 PropertyDecorator 使用 | ||
const internalPropertyKey = Symbol(propertyKey); | ||
@@ -153,3 +160,3 @@ Object.defineProperty(target, propertyKey, { | ||
// 如果属性值是函数,包裹一下,否则不处理 | ||
value = typeof value === 'function' ? functionWrapperFn(value) : value; | ||
value = typeof value === 'function' ? functionWrapperFn(value, ...names) : value; | ||
// 对这个属性的初始值赋值过程也包裹一下 | ||
@@ -172,2 +179,6 @@ propertyInitWrapperFn(() => { | ||
function joinName(restNames) { | ||
return restNames.filter(i => !!i).reverse().join(':'); | ||
} | ||
class RunnerManager { | ||
@@ -259,3 +270,3 @@ constructor() { | ||
enumerable: false, | ||
value: restNames.join('') | ||
value: joinName(restNames) | ||
}); | ||
@@ -305,3 +316,3 @@ } | ||
enumerable: false, | ||
value: restNames.join() | ||
value: joinName(restNames) | ||
}); | ||
@@ -338,3 +349,4 @@ } | ||
} | ||
const identity = transactionManager.getUUID(restNames.join('')); | ||
const name = joinName(restNames); | ||
const identity = transactionManager.getUUID(name); | ||
function wrapper(...args) { | ||
@@ -353,3 +365,3 @@ transactionManager.start(identity); | ||
enumerable: false, | ||
value: restNames.join('') | ||
value: name | ||
}); | ||
@@ -356,0 +368,0 @@ } |
{ | ||
"name": "nemo-observable-util", | ||
"version": "5.3.0", | ||
"version": "5.3.1", | ||
"description": "Simple transparent reactivity with 100% language coverage. Made with ES6 Proxies.", | ||
@@ -5,0 +5,0 @@ "main": "dist/cjs.es5.js", |
128994
2960