@theopenweb/js-sensor
Version:
JavaScript sensor library for native input sensors.
883 lines (882 loc) • 984 kB
JSON
{
"type": "File",
"start": 0,
"end": 8382,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 210,
"column": 38
}
},
"program": {
"type": "Program",
"start": 0,
"end": 8382,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 210,
"column": 38
}
},
"sourceType": "module",
"body": [
{
"type": "ClassDeclaration",
"start": 237,
"end": 8340,
"loc": {
"start": {
"line": 7,
"column": 0
},
"end": {
"line": 208,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 243,
"end": 263,
"loc": {
"start": {
"line": 7,
"column": 6
},
"end": {
"line": 7,
"column": 26
},
"identifierName": "BrowserSensorWatcher"
},
"name": "BrowserSensorWatcher",
"leadingComments": null
},
"superClass": null,
"body": {
"type": "ClassBody",
"start": 264,
"end": 8340,
"loc": {
"start": {
"line": 7,
"column": 27
},
"end": {
"line": 208,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 273,
"end": 6217,
"loc": {
"start": {
"line": 9,
"column": 4
},
"end": {
"line": 138,
"column": 5
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 273,
"end": 284,
"loc": {
"start": {
"line": 9,
"column": 4
},
"end": {
"line": 9,
"column": 15
},
"identifierName": "constructor"
},
"name": "constructor"
},
"kind": "constructor",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 286,
"end": 6217,
"loc": {
"start": {
"line": 9,
"column": 17
},
"end": {
"line": 138,
"column": 5
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 608,
"end": 6210,
"loc": {
"start": {
"line": 16,
"column": 8
},
"end": {
"line": 137,
"column": 10
}
},
"expression": {
"type": "AssignmentExpression",
"start": 608,
"end": 6209,
"loc": {
"start": {
"line": 16,
"column": 8
},
"end": {
"line": 137,
"column": 9
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 608,
"end": 626,
"loc": {
"start": {
"line": 16,
"column": 8
},
"end": {
"line": 16,
"column": 26
}
},
"object": {
"type": "ThisExpression",
"start": 608,
"end": 612,
"loc": {
"start": {
"line": 16,
"column": 8
},
"end": {
"line": 16,
"column": 12
}
},
"leadingComments": null
},
"property": {
"type": "Identifier",
"start": 613,
"end": 626,
"loc": {
"start": {
"line": 16,
"column": 13
},
"end": {
"line": 16,
"column": 26
},
"identifierName": "sensorHandles"
},
"name": "sensorHandles"
},
"computed": false,
"leadingComments": null
},
"right": {
"type": "ObjectExpression",
"start": 629,
"end": 6209,
"loc": {
"start": {
"line": 16,
"column": 29
},
"end": {
"line": 137,
"column": 9
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 961,
"end": 1636,
"loc": {
"start": {
"line": 25,
"column": 12
},
"end": {
"line": 39,
"column": 13
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 961,
"end": 974,
"loc": {
"start": {
"line": 25,
"column": 12
},
"end": {
"line": 25,
"column": 25
},
"identifierName": "watchPosition"
},
"name": "watchPosition",
"leadingComments": null
},
"value": {
"type": "ObjectExpression",
"start": 976,
"end": 1636,
"loc": {
"start": {
"line": 25,
"column": 27
},
"end": {
"line": 39,
"column": 13
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 995,
"end": 1525,
"loc": {
"start": {
"line": 26,
"column": 16
},
"end": {
"line": 37,
"column": 17
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 995,
"end": 1000,
"loc": {
"start": {
"line": 26,
"column": 16
},
"end": {
"line": 26,
"column": 21
},
"identifierName": "start"
},
"name": "start"
},
"value": {
"type": "ArrowFunctionExpression",
"start": 1002,
"end": 1525,
"loc": {
"start": {
"line": 26,
"column": 23
},
"end": {
"line": 37,
"column": 17
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 1003,
"end": 1010,
"loc": {
"start": {
"line": 26,
"column": 24
},
"end": {
"line": 26,
"column": 31
},
"identifierName": "options"
},
"name": "options"
}
],
"body": {
"type": "BlockStatement",
"start": 1013,
"end": 1525,
"loc": {
"start": {
"line": 26,
"column": 34
},
"end": {
"line": 37,
"column": 17
}
},
"body": [
{
"type": "VariableDeclaration",
"start": 1036,
"end": 1076,
"loc": {
"start": {
"line": 27,
"column": 20
},
"end": {
"line": 27,
"column": 60
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 1040,
"end": 1075,
"loc": {
"start": {
"line": 27,
"column": 24
},
"end": {
"line": 27,
"column": 59
}
},
"id": {
"type": "Identifier",
"start": 1040,
"end": 1053,
"loc": {
"start": {
"line": 27,
"column": 24
},
"end": {
"line": 27,
"column": 37
},
"identifierName": "eventListener"
},
"name": "eventListener"
},
"init": {
"type": "MemberExpression",
"start": 1056,
"end": 1075,
"loc": {
"start": {
"line": 27,
"column": 40
},
"end": {
"line": 27,
"column": 59
}
},
"object": {
"type": "MemberExpression",
"start": 1056,
"end": 1070,
"loc": {
"start": {
"line": 27,
"column": 40
},
"end": {
"line": 27,
"column": 54
}
},
"object": {
"type": "Identifier",
"start": 1056,
"end": 1063,
"loc": {
"start": {
"line": 27,
"column": 40
},
"end": {
"line": 27,
"column": 47
},
"identifierName": "options"
},
"name": "options"
},
"property": {
"type": "Identifier",
"start": 1064,
"end": 1070,
"loc": {
"start": {
"line": 27,
"column": 48
},
"end": {
"line": 27,
"column": 54
},
"identifierName": "events"
},
"name": "events"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 1071,
"end": 1075,
"loc": {
"start": {
"line": 27,
"column": 55
},
"end": {
"line": 27,
"column": 59
},
"identifierName": "data"
},
"name": "data"
},
"computed": false
}
}
],
"kind": "let"
},
{
"type": "ReturnStatement",
"start": 1098,
"end": 1506,
"loc": {
"start": {
"line": 28,
"column": 20
},
"end": {
"line": 36,
"column": 23
}
},
"argument": {
"type": "NewExpression",
"start": 1105,
"end": 1505,
"loc": {
"start": {
"line": 28,
"column": 27
},
"end": {
"line": 36,
"column": 22
}
},
"callee": {
"type": "Identifier",
"start": 1109,
"end": 1116,
"loc": {
"start": {
"line": 28,
"column": 31
},
"end": {
"line": 28,
"column": 38
},
"identifierName": "Promise"
},
"name": "Promise"
},
"arguments": [
{
"type": "ArrowFunctionExpression",
"start": 1117,
"end": 1504,
"loc": {
"start": {
"line": 28,
"column": 39
},
"end": {
"line": 36,
"column": 21
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 1118,
"end": 1125,
"loc": {
"start": {
"line": 28,
"column": 40
},
"end": {
"line": 28,
"column": 47
},
"identifierName": "resolve"
},
"name": "resolve"
},
{
"type": "Identifier",
"start": 1127,
"end": 1133,
"loc": {
"start": {
"line": 28,
"column": 49
},
"end": {
"line": 28,
"column": 55
},
"identifierName": "reject"
},
"name": "reject"
}
],
"body": {
"type": "BlockStatement",
"start": 1136,
"end": 1504,
"loc": {
"start": {
"line": 28,
"column": 58
},
"end": {
"line": 36,
"column": 21
}
},
"body": [
{
"type": "VariableDeclaration",
"start": 1163,
"end": 1441,
"loc": {
"start": {
"line": 29,
"column": 24
},
"end": {
"line": 34,
"column": 26
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 1167,
"end": 1440,
"loc": {
"start": {
"line": 29,
"column": 28
},
"end": {
"line": 34,
"column": 25
}
},
"id": {
"type": "Identifier",
"start": 1167,
"end": 1169,
"loc": {
"start": {
"line": 29,
"column": 28
},
"end": {
"line": 29,
"column": 30
},
"identifierName": "id"
},
"name": "id"
},
"init": {
"type": "CallExpression",
"start": 1172,
"end": 1440,
"loc": {
"start": {
"line": 29,
"column": 33
},
"end": {
"line": 34,
"column": 25
}
},
"callee": {
"type": "MemberExpression",
"start": 1172,
"end": 1207,
"loc": {
"start": {
"line": 29,
"column": 33
},
"end": {
"line": 29,
"column": 68
}
},
"object": {
"type": "MemberExpression",
"start": 1172,
"end": 1193,
"loc": {
"start": {
"line": 29,
"column": 33
},
"end": {
"line": 29,
"column": 54
}
},
"object": {
"type": "Identifier",
"start": 1172,
"end": 1181,
"loc": {
"start": {
"line": 29,
"column": 33
},
"end": {
"line": 29,
"column": 42
},
"identifierName": "navigator"
},
"name": "navigator"
},
"property": {
"type": "Identifier",
"start": 1182,
"end": 1193,
"loc": {
"start": {
"line": 29,
"column": 43
},
"end": {
"line": 29,
"column": 54
},
"identifierName": "geolocation"
},
"name": "geolocation"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 1194,
"end": 1207,
"loc": {
"start": {
"line": 29,
"column": 55
},
"end": {
"line": 29,
"column": 68
},
"identifierName": "watchPosition"
},
"name": "watchPosition"
},
"computed": false
},
"arguments": [
{
"type": "Identifier",
"start": 1238,
"end": 1251,
"loc": {
"start": {
"line": 30,
"column": 28
},
"end": {
"line": 30,
"column": 41
},
"identifierName": "eventListener"
},
"name": "eventListener"
},
{
"type": "ArrowFunctionExpression",
"start": 1282,
"end": 1413,
"loc": {
"start": {
"line": 31,
"column": 28
},
"end": {
"line": 33,
"column": 29
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 1283,
"end": 1286,
"loc": {
"start": {
"line": 31,
"column": 29
},
"end": {
"line": 31,
"column": 32
},
"identifierName": "err"
},
"name": "err"
}
],
"body": {
"type": "BlockStatement",
"start": 1289,
"end": 1413,
"loc": {
"start": {
"line": 31,
"column": 35
},
"end": {
"line": 33,
"column": 29
}
},
"body": [
{
"type": "ReturnStatement",
"start": 1324,
"end": 1382,
"loc": {
"start": {
"line": 32,
"column": 32
},
"end": {
"line": 32,
"column": 90
}
},
"argument": {
"type": "CallExpression",
"start": 1331,
"end": 1381,
"loc": {
"start": {
"line": 32,
"column": 39
},
"end": {
"line": 32,
"column": 89
}
},
"callee": {
"type": "Identifier",
"start": 1331,
"end": 1337,
"loc": {
"start": {
"line": 32,
"column": 39
},
"end": {
"line": 32,
"column": 45
},
"identifierName": "reject"
},
"name": "reject"
},
"arguments": [
{
"type": "CallExpression",
"start": 1338,
"end": 1380,
"loc": {
"start": {
"line": 32,
"column": 46
},
"end": {
"line": 32,
"column": 88
}