Skip to content
This repository was archived by the owner on Mar 17, 2025. It is now read-only.

Commit 191c6ac

Browse files
committed
Rename _getKey to $$getKey
1 parent 38e7a36 commit 191c6ac

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/FirebaseArray.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* manually invoked. Instead, one should create a $firebase object and call $asArray
66
* on it: <code>$firebase( firebaseRef ).$asArray()</code>;
77
*
8-
* Internally, the $firebase object depends on this class to provide 5 methods, which it invokes
8+
* Internally, the $firebase object depends on this class to provide 5 $$ methods, which it invokes
99
* to notify the array whenever a change has been made at the server:
1010
* $$added - called whenever a child_added event occurs
1111
* $$updated - called whenever a child_changed event occurs
@@ -15,8 +15,9 @@
1515
* $$process - called immediately after $$added/$$updated/$$moved/$$removed
1616
* to splice/manipulate the array and invokes $$notify
1717
*
18-
* Additionally, there is one more method of interest to devs extending this class:
18+
* Additionally, these methods may be of interest to devs extending this class:
1919
* $$notify - triggers notifications to any $watch listeners, called by $$process
20+
* $$getKey - determines how to look up a record's key (returns $id by default)
2021
*
2122
* Instead of directly modifying this class, one should generally use the $extendFactory
2223
* method to add or change how methods behave. $extendFactory modifies the prototype of
@@ -162,7 +163,7 @@
162163
*/
163164
$keyAt: function(indexOrItem) {
164165
var item = this._resolveItem(indexOrItem);
165-
return this._getKey(item);
166+
return this.$$getKey(item);
166167
},
167168

168169
/**
@@ -176,7 +177,7 @@
176177
$indexFor: function(key) {
177178
var self = this;
178179
// todo optimize and/or cache these? they wouldn't need to be perfect
179-
return this.$list.findIndex(function(rec) { return self._getKey(rec) === key; });
180+
return this.$list.findIndex(function(rec) { return self.$$getKey(rec) === key; });
180181
},
181182

182183
/**
@@ -349,7 +350,7 @@
349350
* @returns {string||null}
350351
* @private
351352
*/
352-
_getKey: function(rec) {
353+
$$getKey: function(rec) {
353354
return angular.isObject(rec)? rec.$id : null;
354355
},
355356

@@ -364,7 +365,7 @@
364365
* @private
365366
*/
366367
$$process: function(event, rec, prevChild) {
367-
var key = this._getKey(rec);
368+
var key = this.$$getKey(rec);
368369
var changed = false;
369370
var pos;
370371
switch(event) {

0 commit comments

Comments
 (0)