Define the _rv object id as a non-enumerable, non-configurable, non-writable property on the object.
Showing
1 changed file
with
9 additions
and
2 deletions
... | @@ -8,8 +8,15 @@ Rivets.adapters['.'] = | ... | @@ -8,8 +8,15 @@ Rivets.adapters['.'] = |
8 | 8 | ||
9 | subscribe: (obj, keypath, callback) -> | 9 | subscribe: (obj, keypath, callback) -> |
10 | unless obj[@id]? | 10 | unless obj[@id]? |
11 | obj[@id] = @counter++ | 11 | id = @counter++ |
12 | @weakmap[obj[@id]] = {} | 12 | |
13 | Object.defineProperty obj, @id, | ||
14 | enumerable: false | ||
15 | configurable: false | ||
16 | writable: false | ||
17 | value: id | ||
18 | |||
19 | @weakmap[id] = {} | ||
13 | 20 | ||
14 | map = @weakmap[obj[@id]] | 21 | map = @weakmap[obj[@id]] |
15 | 22 | ... | ... |
-
Please register or sign in to post a comment