aretherecookies-mobile/js/apis/PositionApi.js

28 lines
552 B
JavaScript
Raw Normal View History

2018-04-22 11:29:08 -05:00
// @flow
import { emitter } from '../streams/LocationStream';
export const getCurrentPosition = () => {
// $FlowFixMe: maximumAge not found on object literal
2018-04-22 11:29:08 -05:00
navigator.geolocation.getCurrentPosition(
(pos: Position) => emitter(pos),
err => {
throw err;
},
{
enableHighAccuracy: false,
timeout: 2000,
}
);
};
// TODO actually implement geolocation for zipcode into lat/lng
export const getPositionFromZip = () => {
const dummyPos: any = {
coords: {
latitude: 30.267,
longitude: -97.7485,
},
};
emitter(dummyPos);
};