UNPKG

766 BJavaScriptView Raw
1"use strict";
2
3const getHeaders = require("./getHeaders");
4
5module.exports = function Navigator(resp) {
6 const navigator = {};
7 const headers = getHeaders(resp.request);
8 const geolocation = Geolocation();
9
10 Object.defineProperty(navigator, "userAgent", {
11 configurable: false,
12 get: () => {
13 return headers["user-agent"] || "Tallahassee";
14 },
15 set: (value) => value
16 });
17
18 Object.defineProperty(navigator, "geolocation", {
19 get: () => {
20 return geolocation;
21 },
22 set: (value) => value
23 });
24
25 return navigator;
26};
27
28function Geolocation() {
29 return {
30 getCurrentPosition,
31 watchPosition,
32 clearWatch
33 };
34
35 function getCurrentPosition() {
36 return {};
37 }
38 function watchPosition() {}
39 function clearWatch() {}
40}