oxygen-core
Version:
Oxygen game engine (Xenon Core for browsers)
1,237 lines (1,236 loc) • 125 kB
JSON
{
"type": "File",
"start": 0,
"end": 828,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 41,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 828,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 41,
"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 * JSON asset loader.\r\n ",
"start": 53,
"end": 84,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 5,
"column": 3
}
}
}
]
},
{
"type": "ExportDefaultDeclaration",
"start": 86,
"end": 826,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 40,
"column": 1
}
},
"declaration": {
"type": "ClassDeclaration",
"start": 101,
"end": 826,
"loc": {
"start": {
"line": 6,
"column": 15
},
"end": {
"line": 40,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 107,
"end": 116,
"loc": {
"start": {
"line": 6,
"column": 21
},
"end": {
"line": 6,
"column": 30
},
"identifierName": "JSONAsset"
},
"name": "JSONAsset",
"leadingComments": null
},
"superClass": {
"type": "Identifier",
"start": 125,
"end": 130,
"loc": {
"start": {
"line": 6,
"column": 39
},
"end": {
"line": 6,
"column": 44
},
"identifierName": "Asset"
},
"name": "Asset"
},
"body": {
"type": "ClassBody",
"start": 131,
"end": 826,
"loc": {
"start": {
"line": 6,
"column": 45
},
"end": {
"line": 40,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 350,
"end": 416,
"loc": {
"start": {
"line": 18,
"column": 2
},
"end": {
"line": 20,
"column": 3
}
},
"static": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 357,
"end": 364,
"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": 365,
"end": 372,
"loc": {
"start": {
"line": 18,
"column": 17
},
"end": {
"line": 18,
"column": 24
}
},
"argument": {
"type": "Identifier",
"start": 368,
"end": 372,
"loc": {
"start": {
"line": 18,
"column": 20
},
"end": {
"line": 18,
"column": 24
},
"identifierName": "args"
},
"name": "args"
}
}
],
"body": {
"type": "BlockStatement",
"start": 374,
"end": 416,
"loc": {
"start": {
"line": 18,
"column": 26
},
"end": {
"line": 20,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 381,
"end": 411,
"loc": {
"start": {
"line": 19,
"column": 4
},
"end": {
"line": 19,
"column": 34
}
},
"argument": {
"type": "NewExpression",
"start": 388,
"end": 410,
"loc": {
"start": {
"line": 19,
"column": 11
},
"end": {
"line": 19,
"column": 33
}
},
"callee": {
"type": "Identifier",
"start": 392,
"end": 401,
"loc": {
"start": {
"line": 19,
"column": 15
},
"end": {
"line": 19,
"column": 24
},
"identifierName": "JSONAsset"
},
"name": "JSONAsset"
},
"arguments": [
{
"type": "SpreadElement",
"start": 402,
"end": 409,
"loc": {
"start": {
"line": 19,
"column": 25
},
"end": {
"line": 19,
"column": 32
}
},
"argument": {
"type": "Identifier",
"start": 405,
"end": 409,
"loc": {
"start": {
"line": 19,
"column": 28
},
"end": {
"line": 19,
"column": 32
},
"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 {JSONAsset} Asset instance.\r\n *\r\n * @example\r\n * system.registerProtocol('json', JSONAsset.factory);\r\n ",
"start": 138,
"end": 346,
"loc": {
"start": {
"line": 8,
"column": 2
},
"end": {
"line": 17,
"column": 5
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * @override \r\n ",
"start": 422,
"end": 449,
"loc": {
"start": {
"line": 22,
"column": 2
},
"end": {
"line": 24,
"column": 5
}
}
}
]
},
{
"type": "ClassMethod",
"start": 453,
"end": 821,
"loc": {
"start": {
"line": 25,
"column": 2
},
"end": {
"line": 38,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 453,
"end": 457,
"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": 460,
"end": 821,
"loc": {
"start": {
"line": 25,
"column": 9
},
"end": {
"line": 38,
"column": 3
}
},
"body": [
{
"type": "VariableDeclaration",
"start": 467,
"end": 500,
"loc": {
"start": {
"line": 26,
"column": 4
},
"end": {
"line": 26,
"column": 37
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 473,
"end": 499,
"loc": {
"start": {
"line": 26,
"column": 10
},
"end": {
"line": 26,
"column": 36
}
},
"id": {
"type": "ObjectPattern",
"start": 473,
"end": 492,
"loc": {
"start": {
"line": 26,
"column": 10
},
"end": {
"line": 26,
"column": 29
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 475,
"end": 483,
"loc": {
"start": {
"line": 26,
"column": 12
},
"end": {
"line": 26,
"column": 20
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 475,
"end": 483,
"loc": {
"start": {
"line": 26,
"column": 12
},
"end": {
"line": 26,
"column": 20
},
"identifierName": "filename"
},
"name": "filename"
},
"value": {
"type": "Identifier",
"start": 475,
"end": 483,
"loc": {
"start": {
"line": 26,
"column": 12
},
"end": {
"line": 26,
"column": 20
},
"identifierName": "filename"
},
"name": "filename"
},
"extra": {
"shorthand": true
}
},
{
"type": "ObjectProperty",
"start": 485,
"end": 490,
"loc": {
"start": {
"line": 26,
"column": 22
},
"end": {
"line": 26,
"column": 27
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 485,
"end": 490,
"loc": {
"start": {
"line": 26,
"column": 22
},
"end": {
"line": 26,
"column": 27
},
"identifierName": "owner"
},
"name": "owner"
},
"value": {
"type": "Identifier",
"start": 485,
"end": 490,
"loc": {
"start": {
"line": 26,
"column": 22
},
"end": {
"line": 26,
"column": 27
},
"identifierName": "owner"
},
"name": "owner"
},
"extra": {
"shorthand": true
}
}
]
},
"init": {
"type": "ThisExpression",
"start": 495,
"end": 499,
"loc": {
"start": {
"line": 26,
"column": 32
},
"end": {
"line": 26,
"column": 36
}
}
}
}
],
"kind": "const"
},
{
"type": "ReturnStatement",
"start": 508,
"end": 816,
"loc": {
"start": {
"line": 28,
"column": 4
},
"end": {
"line": 37,
"column": 9
}
},
"argument": {
"type": "CallExpression",
"start": 515,
"end": 815,
"loc": {
"start": {
"line": 28,
"column": 11
},
"end": {
"line": 37,
"column": 8
}
},
"callee": {
"type": "MemberExpression",
"start": 515,
"end": 744,
"loc": {
"start": {
"line": 28,
"column": 11
},
"end": {
"line": 33,
"column": 11
}
},
"object": {
"type": "CallExpression",
"start": 515,
"end": 731,
"loc": {
"start": {
"line": 28,
"column": 11
},
"end": {
"line": 32,
"column": 7
}
},
"callee": {
"type": "MemberExpression",
"start": 515,
"end": 594,
"loc": {
"start": {
"line": 28,
"column": 11
},
"end": {
"line": 29,
"column": 11
}
},
"object": {
"type": "CallExpression",
"start": 515,
"end": 581,
"loc": {
"start": {
"line": 28,
"column": 11
},
"end": {
"line": 28,
"column": 77
}
},
"callee": {
"type": "MemberExpression",
"start": 515,
"end": 532,
"loc": {
"start": {
"line": 28,
"column": 11
},
"end": {
"line": 28,
"column": 28
}
},
"object": {
"type": "Identifier",
"start": 515,
"end": 520,
"loc": {
"start": {
"line": 28,
"column": 11
},
"end": {
"line": 28,
"column": 16
},
"identifierName": "owner"
},
"name": "owner"
},
"property": {
"type": "Identifier",
"start": 521,
"end": 532,
"loc": {
"start": {
"line": 28,
"column": 17
},
"end": {
"line": 28,
"column": 28
},
"identifierName": "fetchEngine"
},
"name": "fetchEngine"
},
"computed": false
},
"arguments": [
{
"type": "BinaryExpression",
"start": 533,
"end": 560,
"loc": {
"start": {
"line": 28,
"column": 29
},
"end": {
"line": 28,
"column": 56
}
},
"left": {
"type": "MemberExpression",
"start": 533,
"end": 549,
"loc": {
"start": {
"line": 28,
"column": 29
},
"end": {
"line": 28,
"column": 45
}
},
"object": {
"type": "Identifier",
"start": 533,
"end": 538,
"loc": {
"start": {
"line": 28,
"column": 29
},
"end": {
"line": 28,
"column": 34
},
"identifierName": "owner"
},
"name": "owner"
},
"property": {
"type": "Identifier",
"start": 539,
"end": 549,
"loc": {
"start": {
"line": 28,
"column": 35
},
"end": {
"line": 28,
"column": 45
},
"identifierName": "pathPrefix"
},
"name": "pathPrefix"
},
"computed": false
},
"operator": "+",
"right": {
"type": "Identifier",
"start": 552,
"end": 560,
"loc": {
"start": {
"line": 28,
"column": 48
},
"end": {
"line": 28,
"column": 56
},
"identifierName": "filename"
},
"name": "filename"
}
},
{
"type": "MemberExpression",
"start": 562,
"end": 580,
"loc": {
"start": {
"line": 28,
"column": 58
},
"end": {
"line": 28,
"column": 76
}
},
"object": {
"type": "Identifier",
"start": 562,
"end": 567,
"loc": {
"start": {
"line": 28,
"column": 58
},
"end": {
"line": 28,
"column": 63
},
"identifierName": "owner"
},
"name": "owner"
},
"property": {
"type": "Identifier",
"start": 568,
"end": 580,
"loc": {
"start": {
"line": 28,
"column": 64
},
"end": {
"line": 28,
"column": 76
},
"identifierName": "fetchOptions"
},
"name": "fetchOptions"
},
"computed": false
}
]
},
"property": {
"type": "Identifier",
"start": 590,
"end": 594,
"loc": {
"start": {
"line": 29,
"column": 7
},
"end": {
"line": 29,
"column": 11
},
"identifierName": "then"
},
"name": "then"
},
"computed": false
},
"arguments": [
{
"type": "ArrowFunctionExpression",
"start": 595,
"end": 722,
"loc": {
"start": {
"line": 29,
"column": 12
},
"end": {
"line": 31,
"column": 73
}
},
"id": null,
"generator": false,
"expression": true,
"async": false,
"params": [
{
"type": "Identifier",
"start": 595,
"end": 603,
"loc": {
"start": {
"line": 29,
"column": 12
},
"end": {
"line": 29,
"column": 20
},
"identifierName": "response"
},
"name": "response"
}
],
"body": {
"type": "ConditionalExpression",
"start": 607,
"end": 722,
"loc": {
"start": {
"line": 29,
"column": 24
},
"end": {
"line": 31,
"column": 73
}
},
"test": {
"type": "UnaryExpression",
"start": 607,
"end": 620,
"loc": {
"start": {
"line": 29,
"column": 24
},
"end": {
"line": 29,
"column": 37
}
},
"operator": "!",
"prefix": true,
"argument": {
"type": "UnaryExpression",
"start": 608,
"end": 620,
"loc": {
"start": {
"line": 29,
"column": 25
},
"end": {
"line": 29,
"column": 37
}
},
"operator": "!",
"prefix": true,
"argument": {
"type": "MemberExpression",
"start": 609,
"end": 620,
"loc": {
"start": {
"line": 29,
"column": 26
},
"end": {
"line": 29,
"column": 37
}
},
"object": {
"type": "Identifier",
"start": 609,
"end": 617,
"loc": {
"start": {
"line": 29,
"column": 26
},
"end": {
"line": 29,
"column": 34
},
"identifierName": "response"
},
"name": "response"
},
"property": {
"type": "Identifier",
"start": 618,
"end": 620,
"loc": {
"start": {
"line": 29,
"column": 35
},
"end": {
"line": 29,
"column": 37
},
"identifierName": "ok"
},
"name": "ok"
},
"computed": false
},
"extra": {
"parenthesizedArgument": false
}
},
"extra": {
"parenthesizedArgument": false
}
},
"consequent": {
"type": "CallExpression",
"start": 632,
"end": 647,
"loc": {
"start": {
"line": 30,
"column": 10
},
"end": {
"line": 30,
"column": 25
}
},
"callee": {
"type": "MemberExpression",
"start": 632,
"end": 645,
"loc": {
"start": {
"line": 30,
"column": 10
},
"end": {
"line": 30,
"column": 23
}
},
"object": {
"type": "Identifier",
"start": 632,
"end": 640,
"loc": {
"start": {
"line": 30,
"column": 10
},
"end": {
"line": 30,
"column": 18
},
"identifierName": "response"
},
"name": "response"
},
"property": {
"type": "Identifier",
"start": 641,
"end": 645,
"loc": {
"start": {
"line": 30,
"column": 19
},
"end": {
"line": 30,
"column": 23
},
"identifierName": "json"
},
"name": "json"
},
"computed": false
},
"arguments": []
},
"alternate": {
"type": "CallExpression",
"start": 659,
"end": 722,
"loc": {
"start": {
"line": 31,
"column": 10
},
"end": {
"line": 31,
"column": 73
}
},
"callee": {
"type": "MemberExpression",
"start": 659,
"end": 673,
"loc": {
"start": {
"line": 31,
"column": 10
},
"end": {
"line": 31,
"column": 24
}
},
"object": {
"type": "Identifier",
"start": 659,
"end": 666,
"loc": {
"start": {
"line": 31,
"column": 10
},
"end": {
"line": 31,
"column": 17
},
"identifierName": "Promise"
},
"name": "Promise"
},
"property": {
"type": "Identifier",
"start": 667,
"end": 673,
"loc": {
"start": {
"line": 31,
"column": 18
},
"end": {
"line": 31,
"column": 24
},
"identifierName": "reject"
},
"name": "reject"
},
"computed": false
},
"arguments": [
{
"type": "NewExpression",
"start": 674,
"end": 721,
"loc": {
"start": {
"line": 31,
"column": 25
},
"end": {
"line": 31,
"column": 72
}
},
"callee": {
"type": "Identifier",
"start": 678,
"end": 683,
"loc": {
"start": {
"line": 31,
"column": 29
},
"end": {
"line": 31,
"column": 34
},
"identifierName": "Error"
},
"name": "Error"
},
"arguments": [
{
"type": "TemplateLiteral",
"start": 684,
"end": 720,
"loc": {
"start": {
"line": 31,
"column": 35