Skip to content

Commit b6e3936

Browse files
authored
Merge pull request #26 from dashersw/master
Add a new __getPath property for fetching the path of a proxy
2 parents 7bacc42 + 324e16a commit b6e3936

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

observable-slim.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* understood as possible. Minifies down to roughly 3000 characters.
1313
*/
1414
var ObservableSlim = (function() {
15-
paths = [];
15+
var paths = [];
1616
// An array that stores all of the observables created through the public create() method below.
1717
var observables = [];
1818
// An array of all the objects that we have assigned Proxies to
@@ -157,6 +157,9 @@ var ObservableSlim = (function() {
157157
parentPath.splice(-(i+1),(i+1));
158158
return _getProperty(observable.parentProxy, parentPath.join("."));
159159
}
160+
} else if (property === "__getPath") {
161+
var parentPath = _getPath(target, "__getParent");
162+
return parentPath.slice(0, -12);
160163
}
161164

162165
// for performance improvements, we assign this to a variable so we do not have to lookup the property value again

0 commit comments

Comments
 (0)