UNPKG

oxygen-core

Version:

Oxygen game engine (Xenon Core for browsers)

1,543 lines 83.3 kB
{ "type": "File", "start": 0, "end": 658, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 37, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 658, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 37, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 49, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 49 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 7, "end": 12, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 12 } }, "local": { "type": "Identifier", "start": 7, "end": 12, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 12 }, "identifierName": "Asset" }, "name": "Asset" } } ], "source": { "type": "StringLiteral", "start": 18, "end": 48, "loc": { "start": { "line": 1, "column": 18 }, "end": { "line": 1, "column": 48 } }, "extra": { "rawValue": "../systems/AssetSystem/Asset", "raw": "'../systems/AssetSystem/Asset'" }, "value": "../systems/AssetSystem/Asset" }, "trailingComments": [ { "type": "CommentBlock", "value": "*\r\n * Sound asset laoder.\r\n ", "start": 53, "end": 85, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 5, "column": 3 } } } ] }, { "type": "ExportDefaultDeclaration", "start": 87, "end": 656, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 36, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 102, "end": 656, "loc": { "start": { "line": 6, "column": 15 }, "end": { "line": 36, "column": 1 } }, "id": { "type": "Identifier", "start": 108, "end": 118, "loc": { "start": { "line": 6, "column": 21 }, "end": { "line": 6, "column": 31 }, "identifierName": "SoundAsset" }, "name": "SoundAsset", "leadingComments": null }, "superClass": { "type": "Identifier", "start": 127, "end": 132, "loc": { "start": { "line": 6, "column": 40 }, "end": { "line": 6, "column": 45 }, "identifierName": "Asset" }, "name": "Asset" }, "body": { "type": "ClassBody", "start": 133, "end": 656, "loc": { "start": { "line": 6, "column": 46 }, "end": { "line": 36, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 355, "end": 422, "loc": { "start": { "line": 18, "column": 2 }, "end": { "line": 20, "column": 3 } }, "static": true, "computed": false, "key": { "type": "Identifier", "start": 362, "end": 369, "loc": { "start": { "line": 18, "column": 9 }, "end": { "line": 18, "column": 16 }, "identifierName": "factory" }, "name": "factory" }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "RestElement", "start": 370, "end": 377, "loc": { "start": { "line": 18, "column": 17 }, "end": { "line": 18, "column": 24 } }, "argument": { "type": "Identifier", "start": 373, "end": 377, "loc": { "start": { "line": 18, "column": 20 }, "end": { "line": 18, "column": 24 }, "identifierName": "args" }, "name": "args" } } ], "body": { "type": "BlockStatement", "start": 379, "end": 422, "loc": { "start": { "line": 18, "column": 26 }, "end": { "line": 20, "column": 3 } }, "body": [ { "type": "ReturnStatement", "start": 386, "end": 417, "loc": { "start": { "line": 19, "column": 4 }, "end": { "line": 19, "column": 35 } }, "argument": { "type": "NewExpression", "start": 393, "end": 416, "loc": { "start": { "line": 19, "column": 11 }, "end": { "line": 19, "column": 34 } }, "callee": { "type": "Identifier", "start": 397, "end": 407, "loc": { "start": { "line": 19, "column": 15 }, "end": { "line": 19, "column": 25 }, "identifierName": "SoundAsset" }, "name": "SoundAsset" }, "arguments": [ { "type": "SpreadElement", "start": 408, "end": 415, "loc": { "start": { "line": 19, "column": 26 }, "end": { "line": 19, "column": 33 } }, "argument": { "type": "Identifier", "start": 411, "end": 415, "loc": { "start": { "line": 19, "column": 29 }, "end": { "line": 19, "column": 33 }, "identifierName": "args" }, "name": "args" } } ] } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\r\n * Asset factory.\r\n *\r\n * @param {*}\targs - Factory parameters.\r\n *\r\n * @return {SoundAsset} Asset instance.\r\n *\r\n * @example\r\n * system.registerProtocol('sound', SoundAsset.factory);\r\n ", "start": 140, "end": 351, "loc": { "start": { "line": 8, "column": 2 }, "end": { "line": 17, "column": 5 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\r\n * @override\r\n ", "start": 428, "end": 454, "loc": { "start": { "line": 22, "column": 2 }, "end": { "line": 24, "column": 5 } } } ] }, { "type": "ClassMethod", "start": 458, "end": 651, "loc": { "start": { "line": 25, "column": 2 }, "end": { "line": 34, "column": 3 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 458, "end": 462, "loc": { "start": { "line": 25, "column": 2 }, "end": { "line": 25, "column": 6 }, "identifierName": "load" }, "name": "load", "leadingComments": null }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 465, "end": 651, "loc": { "start": { "line": 25, "column": 9 }, "end": { "line": 34, "column": 3 } }, "body": [ { "type": "VariableDeclaration", "start": 472, "end": 505, "loc": { "start": { "line": 26, "column": 4 }, "end": { "line": 26, "column": 37 } }, "declarations": [ { "type": "VariableDeclarator", "start": 478, "end": 504, "loc": { "start": { "line": 26, "column": 10 }, "end": { "line": 26, "column": 36 } }, "id": { "type": "ObjectPattern", "start": 478, "end": 497, "loc": { "start": { "line": 26, "column": 10 }, "end": { "line": 26, "column": 29 } }, "properties": [ { "type": "ObjectProperty", "start": 480, "end": 488, "loc": { "start": { "line": 26, "column": 12 }, "end": { "line": 26, "column": 20 } }, "method": false, "shorthand": true, "computed": false, "key": { "type": "Identifier", "start": 480, "end": 488, "loc": { "start": { "line": 26, "column": 12 }, "end": { "line": 26, "column": 20 }, "identifierName": "filename" }, "name": "filename" }, "value": { "type": "Identifier", "start": 480, "end": 488, "loc": { "start": { "line": 26, "column": 12 }, "end": { "line": 26, "column": 20 }, "identifierName": "filename" }, "name": "filename" }, "extra": { "shorthand": true } }, { "type": "ObjectProperty", "start": 490, "end": 495, "loc": { "start": { "line": 26, "column": 22 }, "end": { "line": 26, "column": 27 } }, "method": false, "shorthand": true, "computed": false, "key": { "type": "Identifier", "start": 490, "end": 495, "loc": { "start": { "line": 26, "column": 22 }, "end": { "line": 26, "column": 27 }, "identifierName": "owner" }, "name": "owner" }, "value": { "type": "Identifier", "start": 490, "end": 495, "loc": { "start": { "line": 26, "column": 22 }, "end": { "line": 26, "column": 27 }, "identifierName": "owner" }, "name": "owner" }, "extra": { "shorthand": true } } ] }, "init": { "type": "ThisExpression", "start": 500, "end": 504, "loc": { "start": { "line": 26, "column": 32 }, "end": { "line": 26, "column": 36 } } } } ], "kind": "const" }, { "type": "ReturnStatement", "start": 513, "end": 646, "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 33, "column": 9 } }, "argument": { "type": "CallExpression", "start": 520, "end": 645, "loc": { "start": { "line": 28, "column": 11 }, "end": { "line": 33, "column": 8 } }, "callee": { "type": "MemberExpression", "start": 520, "end": 567, "loc": { "start": { "line": 28, "column": 11 }, "end": { "line": 29, "column": 11 } }, "object": { "type": "CallExpression", "start": 520, "end": 554, "loc": { "start": { "line": 28, "column": 11 }, "end": { "line": 28, "column": 45 } }, "callee": { "type": "MemberExpression", "start": 520, "end": 530, "loc": { "start": { "line": 28, "column": 11 }, "end": { "line": 28, "column": 21 } }, "object": { "type": "Identifier", "start": 520, "end": 525, "loc": { "start": { "line": 28, "column": 11 }, "end": { "line": 28, "column": 16 }, "identifierName": "owner" }, "name": "owner" }, "property": { "type": "Identifier", "start": 526, "end": 530, "loc": { "start": { "line": 28, "column": 17 }, "end": { "line": 28, "column": 21 }, "identifierName": "load" }, "name": "load" }, "computed": false }, "arguments": [ { "type": "TemplateLiteral", "start": 531, "end": 553, "loc": { "start": { "line": 28, "column": 22 }, "end": { "line": 28, "column": 44 } }, "expressions": [ { "type": "Identifier", "start": 543, "end": 551, "loc": { "start": { "line": 28, "column": 34 }, "end": { "line": 28, "column": 42 }, "identifierName": "filename" }, "name": "filename" } ], "quasis": [ { "type": "TemplateElement", "start": 532, "end": 541, "loc": { "start": { "line": 28, "column": 23 }, "end": { "line": 28, "column": 32 } }, "value": { "raw": "binary://", "cooked": "binary://" }, "tail": false }, { "type": "TemplateElement", "start": 552, "end": 552, "loc": { "start": { "line": 28, "column": 43 }, "end": { "line": 28, "column": 43 } }, "value": { "raw": "", "cooked": "" }, "tail": true } ] } ] }, "property": { "type": "Identifier", "start": 563, "end": 567, "loc": { "start": { "line": 29, "column": 7 }, "end": { "line": 29, "column": 11 }, "identifierName": "then" }, "name": "then" }, "computed": false }, "arguments": [ { "type": "ArrowFunctionExpression", "start": 568, "end": 644, "loc": { "start": { "line": 29, "column": 12 }, "end": { "line": 33, "column": 7 } }, "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 568, "end": 573, "loc": { "start": { "line": 29, "column": 12 }, "end": { "line": 29, "column": 17 }, "identifierName": "asset" }, "name": "asset" } ], "body": { "type": "BlockStatement", "start": 577, "end": 644, "loc": { "start": { "line": 29, "column": 21 }, "end": { "line": 33, "column": 7 } }, "body": [ { "type": "ExpressionStatement", "start": 588, "end": 611, "loc": { "start": { "line": 30, "column": 8 }, "end": { "line": 30, "column": 31 } }, "expression": { "type": "AssignmentExpression", "start": 588, "end": 610, "loc": { "start": { "line": 30, "column": 8 }, "end": { "line": 30, "column": 30 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 588, "end": 597, "loc": { "start": { "line": 30, "column": 8 }, "end": { "line": 30, "column": 17 } }, "object": { "type": "ThisExpression", "start": 588, "end": 592, "loc": { "start": { "line": 30, "column": 8 }, "end": { "line": 30, "column": 12 } } }, "property": { "type": "Identifier", "start": 593, "end": 597, "loc": { "start": { "line": 30, "column": 13 }, "end": { "line": 30, "column": 17 }, "identifierName": "data" }, "name": "data" }, "computed": false }, "right": { "type": "MemberExpression", "start": 600, "end": 610, "loc": { "start": { "line": 30, "column": 20 }, "end": { "line": 30, "column": 30 } }, "object": { "type": "Identifier", "start": 600, "end": 605, "loc": { "start": { "line": 30, "column": 20 }, "end": { "line": 30, "column": 25 }, "identifierName": "asset" }, "name": "asset" }, "property": { "type": "Identifier", "start": 606, "end": 610, "loc": { "start": { "line": 30, "column": 26 }, "end": { "line": 30, "column": 30 }, "identifierName": "data" }, "name": "data" }, "computed": false } } }, { "type": "ReturnStatement", "start": 623, "end": 635, "loc": { "start": { "line": 32, "column": 8 }, "end": { "line": 32, "column": 20 } }, "argument": { "type": "ThisExpression", "start": 630, "end": 634, "loc": { "start": { "line": 32, "column": 15 }, "end": { "line": 32, "column": 19 } } } } ], "directives": [] } } ] } } ], "directives": [] }, "leadingComments": [ { "type": "CommentBlock", "value": "*\r\n * @override\r\n ", "start": 428, "end": 454, "loc": { "start": { "line": 22, "column": 2 }, "end": { "line": 24, "column": 5 } } } ] } ] }, "leadingComments": [ { "type": "CommentBlock", "value": "*\r\n * Sound asset laoder.\r\n ", "start": 53, "end": 85, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 5, "column": 3 } } } ], "trailingComments": [] }, "leadingComments": [ { "type": "CommentBlock", "value": "*\r\n * Sound asset laoder.\r\n ", "start": 53, "end": 85, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 5, "column": 3 } } } ] } ], "directives": [] }, "comments": [ { "type": "CommentBlock", "value": "*\r\n * Sound asset laoder.\r\n ", "start": 53, "end": 85, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 5, "column": 3 } } }, { "type": "CommentBlock", "value": "*\r\n * Asset factory.\r\n *\r\n * @param {*}\targs - Factory parameters.\r\n *\r\n * @return {SoundAsset} Asset instance.\r\n *\r\n * @example\r\n * system.registerProtocol('sound', SoundAsset.factory);\r\n ", "start": 140, "end": 351, "loc": { "start": { "line": 8, "column": 2 }, "end": { "line": 17, "column": 5 } } }, { "type": "CommentBlock", "value": "*\r\n * @override\r\n ", "start": 428, "end": 454, "loc": { "start": { "line": 22, "column": 2 }, "end": { "line": 24, "column": 5 } } } ], "tokens": [ { "type": { "label": "import", "keyword": "import", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "import", "start": 0, "end": 6, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 6 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "Asset", "start": 7, "end": 12, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 12 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "from", "start": 13, "end": 17, "loc": { "start": { "line": 1, "column": 13 }, "end": { "line": 1, "column": 17 } } }, { "type": { "label": "string", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "../systems/AssetSystem/Asset", "start": 18, "end": 48, "loc": { "start": { "line": 1, "column": 18 }, "end": { "line": 1, "column": 48 } } }, { "type": { "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 48, "end": 49, "loc": { "start": { "line": 1, "column": 48 }, "end": { "line": 1, "column": 49 } } }, { "type": "CommentBlock", "value": "*\r\n * Sound asset laoder.\r\n ", "start": 53, "end": 85, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 5, "column": 3 } } }, { "type": { "label": "export", "keyword": "export", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "export", "start": 87, "end": 93, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 6, "column": 6 } } }, { "type": { "label": "default", "keyword": "default", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "default", "start": 94, "end": 101, "loc": { "start": { "line": 6, "column": 7 }, "end": { "line": 6, "column": 14 } } }, { "type": { "label": "class", "keyword": "class", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "class", "start": 102, "end": 107, "loc": { "start": { "line": 6, "column": 15 }, "end": { "line": 6, "column": 20 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "SoundAsset", "start": 108, "end": 118, "loc": { "start": { "line": 6, "column": 21 }, "end": { "line": 6, "column": 31 } } }, { "type": { "label": "extends", "keyword": "extends", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "extends", "start": 119, "end": 126, "loc": { "start": { "line": 6, "column": 32 }, "end": { "line": 6, "column": 39 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "Asset", "start": 127, "end": 132, "loc": { "start": { "line": 6, "column": 40 }, "end": { "line": 6, "column": 45 } } }, { "type": { "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 133, "end": 134, "loc": { "start": { "line": 6, "column": 46 }, "end": { "line": 6, "column": 47 } } }, { "type": "CommentBlock", "value": "*\r\n * Asset factory.\r\n *\r\n * @param {*}\targs - Factory parameters.\r\n *\r\n * @return {SoundAsset} Asset instance.\r\n *\r\n * @example\r\n * system.registerProtocol('sound', SoundAsset.factory);\r\n ", "start": 140, "end": 351, "loc": { "start": { "line": 8, "column": 2 }, "end": { "line": 17, "column": 5 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "static", "start": 355, "end": 3