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

Commit 7c3fae6

Browse files
committed
Use a single ref creator function
1 parent 143715d commit 7c3fae6

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

src/firebaseRef.js

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,15 @@ FirebaseRefNotProvidedError.prototype.constructor = FirebaseRefNotProvidedError;
1010

1111
function FirebaseRef() {
1212
this.urls = null;
13-
this.singleUrl = false;
1413
this.registerUrl = function registerUrl(urlOrConfig) {
1514

1615
if (typeof urlOrConfig === 'string') {
1716
this.urls = {};
1817
this.urls.default = urlOrConfig;
19-
this.singleUrl = true;
2018
}
2119

2220
if (angular.isObject(urlOrConfig)) {
2321
this.urls = urlOrConfig;
24-
this.singleUrl = false;
2522
}
2623

2724
};
@@ -32,13 +29,7 @@ function FirebaseRef() {
3229
}
3330
};
3431

35-
this.$$createSingleRef = function $$createSingleRef(defaultUrl) {
36-
var error = this.$$checkUrls(defaultUrl);
37-
if (error) { throw error; }
38-
return new Firebase(defaultUrl);
39-
};
40-
41-
this.$$createMultipleRefs = function $$createMultipleRefs(urlConfig) {
32+
this.$$createRefsFromUrlConfig = function $$createMultipleRefs(urlConfig) {
4233
var error = this.$$checkUrls(urlConfig);
4334
if (error) { throw error; }
4435
var defaultUrl = urlConfig.default;
@@ -55,13 +46,7 @@ function FirebaseRef() {
5546
};
5647

5748
this.$get = function FirebaseRef_$get() {
58-
59-
if (this.singleUrl) {
60-
return this.$$createSingleRef(this.urls.default);
61-
} else {
62-
return this.$$createMultipleRefs(this.urls);
63-
}
64-
49+
return this.$$createRefsFromUrlConfig(this.urls);
6550
};
6651
}
6752

0 commit comments

Comments
 (0)