publish(obaa): v2.1.0

This commit is contained in:
dntzhang 2019-12-15 10:34:06 +08:00
parent f65c0f7a2c
commit 45c144a2fa
3 changed files with 8 additions and 7 deletions

View File

@ -1,11 +1,11 @@
/*
* obaa 2.0.3
/*
* obaa 2.1.0
* By dntzhang
* Github: https://github.com/Tencent/omi/tree/master/packages/obaa
* MIT Licensed.
*/
// __r_: root
// __c_: prop change callback
// __p_: path
@ -25,6 +25,7 @@
}
if (target && typeof target === 'object' && Object.keys(target).length === 0) {
track(target)
target.__o_.__r_ = target
}
for (var prop in target) {
if (target.hasOwnProperty(prop)) {

View File

@ -1,6 +1,6 @@
{
"name": "obaa",
"version": "2.0.4",
"version": "2.1.0",
"description": "Observe any object's any change.",
"main": "index.js",
"scripts": {

View File

@ -122,9 +122,9 @@ QUnit.test("complex obj", function (assert) {
QUnit.test("empty obj", function (assert) {
var obj = {}
var res
obba(obj, (a, b, c, d) => {
obaa(obj, (a, b, c, d) => {
res = [a, b, c, d]
})
obba.set(obj, 'newProp', 'newPropValue')
assert.equal(obj.newProp, newPropValue)
obaa.set(obj, 'newProp', 'newPropValue')
assert.equal(obj.newProp, 'newPropValue')
})