-
Notifications
You must be signed in to change notification settings - Fork 2
/
weather.js
25 lines (25 loc) · 1020 Bytes
/
weather.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
var Firebase = require("firebase");
var Rx = require('@reactivex/rxjs');
var Weather = (function () {
function Weather() {
var _this = this;
this.weatherDataSubject = new Rx.Subject();
this.weatherDetailSubject = new Rx.Subject();
this.weatherForcastSubject = new Rx.Subject();
this.getWeatherDetails = function (city) {
_this.firebase.child('/' + city + '/currently').on("value", function (result) {
_this.weatherDetailSubject.next(result.val());
});
_this.firebase.child('/' + city + '/daily/data').on("value", function (result) {
_this.weatherForcastSubject.next(result.val());
});
};
this.firebase = new Firebase('https://publicdata-weather.firebaseio.com');
this.firebase.on("value", function (result) {
_this.weatherDataSubject.next(result.val());
});
}
return Weather;
})();
exports.Weather = Weather;
//# sourceMappingURL=weather.js.map