UNPKG

soocrate-core

Version:

this is the core of soocrate application

1,452 lines (1,451 loc) 216 kB
{ "type": "File", "start": 0, "end": 1061, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 42, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 1061, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 42, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 27, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 27 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 7, "end": 8, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 8 } }, "local": { "type": "Identifier", "start": 7, "end": 8, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 8 }, "identifierName": "S" }, "name": "S" } } ], "source": { "type": "StringLiteral", "start": 14, "end": 26, "loc": { "start": { "line": 1, "column": 14 }, "end": { "line": 1, "column": 26 } }, "extra": { "rawValue": "spray-wrtc", "raw": "'spray-wrtc'" }, "value": "spray-wrtc" } }, { "type": "VariableDeclaration", "start": 31, "end": 102, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 4, "column": 36 } }, "declarations": [ { "type": "VariableDeclarator", "start": 35, "end": 101, "loc": { "start": { "line": 3, "column": 4 }, "end": { "line": 4, "column": 35 } }, "id": { "type": "Identifier", "start": 35, "end": 39, "loc": { "start": { "line": 3, "column": 4 }, "end": { "line": 3, "column": 8 }, "identifierName": "opts" }, "name": "opts" }, "init": { "type": "ObjectExpression", "start": 42, "end": 101, "loc": { "start": { "line": 3, "column": 11 }, "end": { "line": 4, "column": 35 } }, "properties": [ { "type": "ObjectProperty", "start": 43, "end": 63, "loc": { "start": { "line": 3, "column": 12 }, "end": { "line": 3, "column": 32 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 43, "end": 52, "loc": { "start": { "line": 3, "column": 12 }, "end": { "line": 3, "column": 21 }, "identifierName": "deltatime" }, "name": "deltatime" }, "value": { "type": "BinaryExpression", "start": 54, "end": 63, "loc": { "start": { "line": 3, "column": 23 }, "end": { "line": 3, "column": 32 } }, "left": { "type": "BinaryExpression", "start": 54, "end": 61, "loc": { "start": { "line": 3, "column": 23 }, "end": { "line": 3, "column": 30 } }, "left": { "type": "NumericLiteral", "start": 54, "end": 58, "loc": { "start": { "line": 3, "column": 23 }, "end": { "line": 3, "column": 27 } }, "extra": { "rawValue": 1000, "raw": "1000" }, "value": 1000 }, "operator": "*", "right": { "type": "NumericLiteral", "start": 59, "end": 61, "loc": { "start": { "line": 3, "column": 28 }, "end": { "line": 3, "column": 30 } }, "extra": { "rawValue": 60, "raw": "60" }, "value": 60 } }, "operator": "*", "right": { "type": "NumericLiteral", "start": 62, "end": 63, "loc": { "start": { "line": 3, "column": 31 }, "end": { "line": 3, "column": 32 } }, "extra": { "rawValue": 1, "raw": "1" }, "value": 1 } } }, { "type": "ObjectProperty", "start": 78, "end": 100, "loc": { "start": { "line": 4, "column": 12 }, "end": { "line": 4, "column": 34 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 78, "end": 84, "loc": { "start": { "line": 4, "column": 12 }, "end": { "line": 4, "column": 18 }, "identifierName": "webrtc" }, "name": "webrtc" }, "value": { "type": "ObjectExpression", "start": 86, "end": 100, "loc": { "start": { "line": 4, "column": 20 }, "end": { "line": 4, "column": 34 } }, "properties": [ { "type": "ObjectProperty", "start": 87, "end": 99, "loc": { "start": { "line": 4, "column": 21 }, "end": { "line": 4, "column": 33 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 87, "end": 94, "loc": { "start": { "line": 4, "column": 21 }, "end": { "line": 4, "column": 28 }, "identifierName": "trickle" }, "name": "trickle" }, "value": { "type": "BooleanLiteral", "start": 95, "end": 99, "loc": { "start": { "line": 4, "column": 29 }, "end": { "line": 4, "column": 33 } }, "value": true } } ] } } ] } } ], "kind": "var", "trailingComments": [ { "type": "CommentLine", "value": " # create 3 peers ", "start": 106, "end": 126, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 6, "column": 20 } } } ] }, { "type": "VariableDeclaration", "start": 128, "end": 149, "loc": { "start": { "line": 7, "column": 0 }, "end": { "line": 7, "column": 21 } }, "declarations": [ { "type": "VariableDeclarator", "start": 132, "end": 148, "loc": { "start": { "line": 7, "column": 4 }, "end": { "line": 7, "column": 20 } }, "id": { "type": "Identifier", "start": 132, "end": 134, "loc": { "start": { "line": 7, "column": 4 }, "end": { "line": 7, "column": 6 }, "identifierName": "s1" }, "name": "s1", "leadingComments": null }, "init": { "type": "NewExpression", "start": 137, "end": 148, "loc": { "start": { "line": 7, "column": 9 }, "end": { "line": 7, "column": 20 } }, "callee": { "type": "Identifier", "start": 141, "end": 142, "loc": { "start": { "line": 7, "column": 13 }, "end": { "line": 7, "column": 14 }, "identifierName": "S" }, "name": "S" }, "arguments": [ { "type": "Identifier", "start": 143, "end": 147, "loc": { "start": { "line": 7, "column": 15 }, "end": { "line": 7, "column": 19 }, "identifierName": "opts" }, "name": "opts" } ] }, "leadingComments": null } ], "kind": "var", "leadingComments": [ { "type": "CommentLine", "value": " # create 3 peers ", "start": 106, "end": 126, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 6, "column": 20 } } } ] }, { "type": "VariableDeclaration", "start": 151, "end": 172, "loc": { "start": { "line": 8, "column": 0 }, "end": { "line": 8, "column": 21 } }, "declarations": [ { "type": "VariableDeclarator", "start": 155, "end": 171, "loc": { "start": { "line": 8, "column": 4 }, "end": { "line": 8, "column": 20 } }, "id": { "type": "Identifier", "start": 155, "end": 157, "loc": { "start": { "line": 8, "column": 4 }, "end": { "line": 8, "column": 6 }, "identifierName": "s2" }, "name": "s2" }, "init": { "type": "NewExpression", "start": 160, "end": 171, "loc": { "start": { "line": 8, "column": 9 }, "end": { "line": 8, "column": 20 } }, "callee": { "type": "Identifier", "start": 164, "end": 165, "loc": { "start": { "line": 8, "column": 13 }, "end": { "line": 8, "column": 14 }, "identifierName": "S" }, "name": "S" }, "arguments": [ { "type": "Identifier", "start": 166, "end": 170, "loc": { "start": { "line": 8, "column": 15 }, "end": { "line": 8, "column": 19 }, "identifierName": "opts" }, "name": "opts" } ] } } ], "kind": "var" }, { "type": "VariableDeclaration", "start": 174, "end": 195, "loc": { "start": { "line": 9, "column": 0 }, "end": { "line": 9, "column": 21 } }, "declarations": [ { "type": "VariableDeclarator", "start": 178, "end": 194, "loc": { "start": { "line": 9, "column": 4 }, "end": { "line": 9, "column": 20 } }, "id": { "type": "Identifier", "start": 178, "end": 180, "loc": { "start": { "line": 9, "column": 4 }, "end": { "line": 9, "column": 6 }, "identifierName": "s3" }, "name": "s3" }, "init": { "type": "NewExpression", "start": 183, "end": 194, "loc": { "start": { "line": 9, "column": 9 }, "end": { "line": 9, "column": 20 } }, "callee": { "type": "Identifier", "start": 187, "end": 188, "loc": { "start": { "line": 9, "column": 13 }, "end": { "line": 9, "column": 14 }, "identifierName": "S" }, "name": "S" }, "arguments": [ { "type": "Identifier", "start": 189, "end": 193, "loc": { "start": { "line": 9, "column": 15 }, "end": { "line": 9, "column": 19 }, "identifierName": "opts" }, "name": "opts" } ] } } ], "kind": "var" }, { "type": "VariableDeclaration", "start": 199, "end": 548, "loc": { "start": { "line": 11, "column": 0 }, "end": { "line": 23, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", "start": 203, "end": 547, "loc": { "start": { "line": 11, "column": 4 }, "end": { "line": 23, "column": 1 } }, "id": { "type": "Identifier", "start": 203, "end": 212, "loc": { "start": { "line": 11, "column": 4 }, "end": { "line": 11, "column": 13 }, "identifierName": "callbacks" }, "name": "callbacks" }, "init": { "type": "FunctionExpression", "start": 215, "end": 547, "loc": { "start": { "line": 11, "column": 16 }, "end": { "line": 23, "column": 1 } }, "id": { "type": "Identifier", "start": 203, "end": 212, "loc": { "start": { "line": 11, "column": 4 }, "end": { "line": 11, "column": 13 }, "identifierName": "callbacks" }, "name": "callbacks" }, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 224, "end": 227, "loc": { "start": { "line": 11, "column": 25 }, "end": { "line": 11, "column": 28 }, "identifierName": "src" }, "name": "src" }, { "type": "Identifier", "start": 229, "end": 233, "loc": { "start": { "line": 11, "column": 30 }, "end": { "line": 11, "column": 34 }, "identifierName": "dest" }, "name": "dest" } ], "body": { "type": "BlockStatement", "start": 234, "end": 547, "loc": { "start": { "line": 11, "column": 35 }, "end": { "line": 23, "column": 1 } }, "body": [ { "type": "ReturnStatement", "start": 241, "end": 544, "loc": { "start": { "line": 12, "column": 4 }, "end": { "line": 22, "column": 6 } }, "argument": { "type": "ObjectExpression", "start": 248, "end": 543, "loc": { "start": { "line": 12, "column": 11 }, "end": { "line": 22, "column": 5 } }, "properties": [ { "type": "ObjectProperty", "start": 259, "end": 357, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 15, "column": 9 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 259, "end": 269, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 18 }, "identifierName": "onInitiate" }, "name": "onInitiate" }, "value": { "type": "FunctionExpression", "start": 271, "end": 357, "loc": { "start": { "line": 13, "column": 20 }, "end": { "line": 15, "column": 9 } }, "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 280, "end": 285, "loc": { "start": { "line": 13, "column": 29 }, "end": { "line": 13, "column": 34 }, "identifierName": "offer" }, "name": "offer" } ], "body": { "type": "BlockStatement", "start": 286, "end": 357, "loc": { "start": { "line": 13, "column": 35 }, "end": { "line": 15, "column": 9 } }, "body": [ { "type": "ExpressionStatement", "start": 301, "end": 346, "loc": { "start": { "line": 14, "column": 12 }, "end": { "line": 14, "column": 57 } }, "expression": { "type": "CallExpression", "start": 301, "end": 345, "loc": { "start": { "line": 14, "column": 12 }, "end": { "line": 14, "column": 56 } }, "callee": { "type": "MemberExpression", "start": 301, "end": 316, "loc": { "start": { "line": 14, "column": 12 }, "end": { "line": 14, "column": 27 } }, "object": { "type": "Identifier", "start": 301, "end": 305, "loc": { "start": { "line": 14, "column": 12 }, "end": { "line": 14, "column": 16 }, "identifierName": "dest" }, "name": "dest" }, "property": { "type": "Identifier", "start": 306, "end": 316, "loc": { "start": { "line": 14, "column": 17 }, "end": { "line": 14, "column": 27 }, "identifierName": "connection" }, "name": "connection" }, "computed": false }, "arguments": [ { "type": "CallExpression", "start": 317, "end": 337, "loc": { "start": { "line": 14, "column": 28 }, "end": { "line": 14, "column": 48 } }, "callee": { "type": "Identifier", "start": 317, "end": 326, "loc": { "start": { "line": 14, "column": 28 }, "end": { "line": 14, "column": 37 }, "identifierName": "callbacks" }, "name": "callbacks" }, "arguments": [ { "type": "Identifier", "start": 327, "end": 331, "loc": { "start": { "line": 14, "column": 38 }, "end": { "line": 14, "column": 42 }, "identifierName": "dest" }, "name": "dest" }, { "type": "Identifier", "start": 333, "end": 336, "loc": { "start": { "line": 14, "column": 44 }, "end": { "line": 14, "column": 47 }, "identifierName": "src" }, "name": "src" } ] }, { "type": "Identifier", "start": 339, "end": 344, "loc": { "start": { "line": 14, "column": 50 }, "end": { "line": 14, "column": 55 }, "identifierName": "offer" }, "name": "offer" } ] } } ], "directives": [] } } }, { "type": "ObjectProperty", "start": 368, "end": 442, "loc": { "start": { "line": 16, "column": 8 }, "end": { "line": 18, "column": 9 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 368, "end": 376, "loc": { "start": { "line": 16, "column": 8 }, "end": { "line": 16, "column": 16 }, "identifierName": "onAccept" }, "name": "onAccept" }, "value": { "type": "FunctionExpression", "start": 378, "end": 442, "loc": { "start": { "line": 16, "column": 18 }, "end": { "line": 18, "column": 9 } }, "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 387, "end": 392, "loc": { "start": { "line": 16, "column": 27 }, "end": { "line": 16, "column": 32 }, "identifierName": "offer" }, "name": "offer" } ], "body": { "type": "BlockStatement", "start": 393, "end": 442, "loc": { "start": { "line": 16, "column": 33 }, "end": { "line": 18, "column": 9 } }, "body": [ { "type": "ExpressionStatement", "start": 408, "end": 431, "loc": { "start": { "line": 17, "column": 12 }, "end": { "line": 17, "column": 35 } }, "expression": { "type": "CallExpression", "start": 408, "end": 430, "loc": { "start": { "line": 17, "column": 12 }, "end": { "line": 17, "column": 34 } }, "callee": { "type": "MemberExpression", "start": 408, "end": 423, "loc": { "start": { "line": 17, "column": 12 }, "end": { "line": 17, "column": 27 } }, "object": { "type": "Identifier", "start": 408, "end": 412, "loc": { "start": { "line": 17, "column": 12 }, "end": { "line": 17, "column": 16 }, "identifierName": "dest" }, "name": "dest" }, "property": { "type": "Identifier", "start": 413, "end": 423, "loc": { "start": { "line": 17, "column": 17 }, "end": { "line": 17, "column": 27 }, "identifierName": "connection" }, "name": "connection" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 424, "end": 429, "loc": { "start": { "line": 17, "column": 28 }, "end": { "line": 17, "column": 33 }, "identifierName": "offer" }, "name": "offer" } ] } } ], "directives": [] } } }, { "type": "ObjectProperty", "start": 453, "end": 536, "loc": { "start": { "line": 19, "column": 8 }, "end": { "line": 21, "column": 9 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 453, "end": 460, "loc": { "start": { "line": 19, "column": 8 }, "end": { "line": 19, "column": 15 }, "identifierName": "onReady" }, "name": "onReady" }, "value": { "type": "FunctionExpression", "start": 462, "end": 536, "loc": { "start": { "line": 19, "column": 17 }, "end": { "line": 21, "column": 9 } }, "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 472, "end": 536, "loc": { "start": { "line": 19, "column": 27 }, "end": { "line": 21, "column": 9 } }, "body": [ { "type": "ExpressionStatement", "start": 487, "end": 525, "loc": { "start": { "line": 20, "column": 12 }, "end": { "line": 20, "column": 50 } }, "expression": { "type": "CallExpression", "start": 487, "end": 524, "loc": { "start": { "line": 20, "column": 12 }, "end": { "line": 20, "column": 49 } }, "callee": { "type": "MemberExpression", "start": 487, "end": 498, "loc": { "start": { "line": 20, "column": 12 }, "end": {