Skip to content

Commit 0bee550

Browse files
author
jacobawenger
committed
Added GeoFire.ref() method and bumped version to 2.1.0
1 parent 63aa954 commit 0bee550

File tree

17 files changed

+125
-28
lines changed

17 files changed

+125
-28
lines changed

.jshintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"predef": [
3-
"require",
43
"module",
4+
"require",
5+
"Firebase",
56
"setInterval"
67
],
78
"bitwise": true,

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
v2.1.0
2+
-------------
3+
Release Date: 2014-06-29
4+
5+
* Added GeoFire.ref() method.
6+
* Added error checking for firebaseRef parameter.
7+
18
v2.0.2
29
-------------
310
Release Date: 2014-06-23

README.md

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ In order to use GeoFire in your project, you need to include the following files
3737
<script src="https://cdn.firebase.com/js/client/1.0.17/firebase.js"></script>
3838

3939
<!-- GeoFire -->
40-
<script src="https://cdn.firebase.com/libs/geofire/2.0.2/geofire.min.js"></script>
40+
<script src="https://cdn.firebase.com/libs/geofire/2.1.0/geofire.min.js"></script>
4141
```
4242

4343
Use the URL above to download both the minified and non-minifed versions of GeoFire from the Firebase CDN. You can also download them from the
@@ -51,7 +51,7 @@ $ npm install geofire --save
5151
```
5252

5353
```bash
54-
$ bower install geofire
54+
$ bower install geofire --save
5555
```
5656

5757
## Getting Started with Firebase
@@ -71,10 +71,21 @@ the location pointed to by `firebaseRef`. Note that this `firebaseRef` can point
7171

7272
```JavaScript
7373
// Create a Firebase reference where GeoFire will store its information
74-
var dataRef = new Firebase("https://<my_firebase>.firebaseio.com/");
74+
var firebaseRef = new Firebase("https://<my_firebase>.firebaseio.com/");
7575

7676
// Create a GeoFire index
77-
var geoFire = new GeoFire(dataRef);
77+
var geoFire = new GeoFire(firebaseRef);
78+
```
79+
80+
#### GeoFire.ref()
81+
82+
Returns the `Firebase` instance used to create this `GeoFire` instance.
83+
84+
```JavaScript
85+
var firebaseRef = new Firebase("https://<my_firebase>.firebaseio.com/");
86+
var geoFire = new GeoFire(firebaseRef);
87+
88+
var ref = geoFire.ref() // ref === firebaseRef
7889
```
7990

8091
#### GeoFire.set(key, location)
@@ -329,11 +340,12 @@ If you'd like to contribute to GeoFire, you'll need to run the following command
329340

330341
```bash
331342
$ git clone https://github.com/firebase/geofire.git
332-
$ npm install # install local npm build / test dependencies
333-
$ bower install # install local JavaScript dependencies
334-
$ gulp watch # watch for source file changes
343+
$ npm install -g gulp # globally intall gulp task runnger
344+
$ npm install # install local npm build / test dependencies
345+
$ bower install # install local JavaScript dependencies
346+
$ gulp watch # watch for source file changes
335347
```
336348

337349
`gulp watch` will watch for changes in the `/src/` directory and lint, concatenate, and minify the source files when a change occurs. The output files - `geofire.js` and `geofire.min.js` - are written to the `/dist/` directory.
338350

339-
You can run the test suite by navigating to `file:///path/to/tests/TestRunner.html` or run the tests via the command line using `gulp test`.
351+
You can run the test suite by navigating to `file:///path/to/geofire/tests/TestRunner.html` or via the command line using `gulp test`.

bower.json

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
{
22
"name": "geofire",
33
"description": "Location-based querying and filtering using Firebase",
4-
"version": "2.0.2",
5-
"main": [
6-
"./dist/geofire.min.js"
4+
"version": "2.1.0",
5+
"main": "./dist/geofire.min.js",
6+
"homepage": "https://github.com/firebase/geofire/",
7+
"license": "MIT",
8+
"authors": [
9+
"jacobawenger <[email protected]>"
10+
],
11+
"keywords": [
12+
"geolocation",
13+
"geoquery",
14+
"location",
15+
"firebase"
716
],
817
"ignore": [
918
"**/.*",
@@ -18,7 +27,7 @@
1827
"examples"
1928
],
2029
"dependencies": {
21-
"firebase": "~1.0.17",
30+
"firebase": "1.0.x",
2231
"rsvp": "~3.0.8"
2332
},
2433
"devDependencies": {

build/header

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// keys based on their geographic location. GeoFire uses Firebase for data
33
// storage, allowing query results to be updated in realtime as they change.
44
//
5-
// GeoFire 2.0.2
5+
// GeoFire 2.1.0
66
// https://github.com/firebase/geofire/
77
// License: MIT
88

dist/geofire.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// keys based on their geographic location. GeoFire uses Firebase for data
33
// storage, allowing query results to be updated in realtime as they change.
44
//
5-
// GeoFire 2.0.2
5+
// GeoFire 2.1.0
66
// https://github.com/firebase/geofire/
77
// License: MIT
88

@@ -172,6 +172,15 @@ var GeoFire = function(firebaseRef) {
172172
/********************/
173173
/* PUBLIC METHODS */
174174
/********************/
175+
/**
176+
* Returns the Firebase instance used to create this GeoFire instance.
177+
*
178+
* @return {Firebase} The Firebase instance used to create this GeoFire instance.
179+
*/
180+
this.ref = function() {
181+
return _firebaseRef;
182+
};
183+
175184
/**
176185
* Adds the provided key - location pair to Firebase. Returns an empty promise which is fulfilled when the write is complete.
177186
*
@@ -238,6 +247,10 @@ var GeoFire = function(firebaseRef) {
238247
/*****************/
239248
/* CONSTRUCTOR */
240249
/*****************/
250+
if (firebaseRef instanceof Firebase === false) {
251+
throw new Error("firebaseRef must be an instance of Firebase");
252+
}
253+
241254
var _firebaseRef = firebaseRef;
242255
};
243256

@@ -1013,6 +1026,9 @@ var GeoQuery = function (firebaseRef, queryCriteria) {
10131026
/* CONSTRUCTOR */
10141027
/*****************/
10151028
// Firebase reference of the GeoFire which created this query
1029+
if (firebaseRef instanceof Firebase === false) {
1030+
throw new Error("firebaseRef must be an instance of Firebase");
1031+
}
10161032
var _firebaseRef = firebaseRef;
10171033

10181034
// Event callbacks

dist/geofire.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/fish1/js/vendor/geofire.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/fish2/js/vendor/geofire.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/fish3/js/vendor/geofire.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)