@sffjunkie/astral
Version:
calculations for the position of the sun and the moon
98 lines (97 loc) • 3.05 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var luxon_1 = require("luxon");
var index_1 = require("./index");
/** Provides access to information for single location. */
var Location = /** @class */ (function () {
function Location(info) {
this.solar_depression = index_1.Depression.CIVIL;
if (info) {
this.location_info = info;
}
else {
this.location_info = index_1.LocationInfo.fromObject({
name: "Greenwich",
region: "England",
timezone: "Europe/London",
latitude: 51.4733,
longitude: -0.00083333
});
}
}
Object.defineProperty(Location.prototype, "info", {
get: function () {
return this.location_info;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Location.prototype, "observer", {
get: function () {
return new index_1.Observer(this.location_info.latitude, this.location_info.longitude, 0.0);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Location.prototype, "name", {
get: function () {
return this.location_info.name;
},
set: function (value) {
this.location_info.name = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Location.prototype, "region", {
get: function () {
return this.location_info.region;
},
set: function (value) {
this.location_info.region = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Location.prototype, "timezone", {
get: function () {
return this.location_info.timezone;
},
set: function (value) {
this.location_info.timezone = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Location.prototype, "latitude", {
get: function () {
return this.location_info.latitude;
},
set: function (value) {
this.location_info.latitude = index_1.dmsToNumber(value);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Location.prototype, "longitude", {
get: function () {
return this.location_info.longitude;
},
set: function (value) {
this.location_info.longitude = index_1.dmsToNumber(value);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Location.prototype, "tzinfo", {
/**
* Return the Luxon IANAZone for this location's timezone */
get: function () {
return new luxon_1.IANAZone(this.location_info.timezone);
},
enumerable: true,
configurable: true
});
return Location;
}());
exports.Location = Location;