oxygen-core
Version:
Oxygen game engine (Xenon Core for browsers)
1,340 lines • 303 kB
JSON
{
"type": "File",
"start": 0,
"end": 1484,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 66,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 1484,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 66,
"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 * Image asset loader.\r\n ",
"start": 53,
"end": 85,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 5,
"column": 3
}
}
}
]
},
{
"type": "ExportDefaultDeclaration",
"start": 87,
"end": 1482,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 65,
"column": 1
}
},
"declaration": {
"type": "ClassDeclaration",
"start": 102,
"end": 1482,
"loc": {
"start": {
"line": 6,
"column": 15
},
"end": {
"line": 65,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 108,
"end": 118,
"loc": {
"start": {
"line": 6,
"column": 21
},
"end": {
"line": 6,
"column": 31
},
"identifierName": "ImageAsset"
},
"name": "ImageAsset",
"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": 1482,
"loc": {
"start": {
"line": 6,
"column": 46
},
"end": {
"line": 65,
"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": "ImageAsset"
},
"name": "ImageAsset"
},
"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 {ImageAsset} Asset instance.\r\n *\r\n * @example\r\n * system.registerProtocol('image', ImageAsset.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": 558,
"loc": {
"start": {
"line": 25,
"column": 2
},
"end": {
"line": 31,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 458,
"end": 465,
"loc": {
"start": {
"line": 25,
"column": 2
},
"end": {
"line": 25,
"column": 9
},
"identifierName": "dispose"
},
"name": "dispose",
"leadingComments": null
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 468,
"end": 558,
"loc": {
"start": {
"line": 25,
"column": 12
},
"end": {
"line": 31,
"column": 3
}
},
"body": [
{
"type": "IfStatement",
"start": 475,
"end": 529,
"loc": {
"start": {
"line": 26,
"column": 4
},
"end": {
"line": 28,
"column": 5
}
},
"test": {
"type": "UnaryExpression",
"start": 479,
"end": 490,
"loc": {
"start": {
"line": 26,
"column": 8
},
"end": {
"line": 26,
"column": 19
}
},
"operator": "!",
"prefix": true,
"argument": {
"type": "UnaryExpression",
"start": 480,
"end": 490,
"loc": {
"start": {
"line": 26,
"column": 9
},
"end": {
"line": 26,
"column": 19
}
},
"operator": "!",
"prefix": true,
"argument": {
"type": "MemberExpression",
"start": 481,
"end": 490,
"loc": {
"start": {
"line": 26,
"column": 10
},
"end": {
"line": 26,
"column": 19
}
},
"object": {
"type": "ThisExpression",
"start": 481,
"end": 485,
"loc": {
"start": {
"line": 26,
"column": 10
},
"end": {
"line": 26,
"column": 14
}
}
},
"property": {
"type": "Identifier",
"start": 486,
"end": 490,
"loc": {
"start": {
"line": 26,
"column": 15
},
"end": {
"line": 26,
"column": 19
},
"identifierName": "data"
},
"name": "data"
},
"computed": false
},
"extra": {
"parenthesizedArgument": false
}
},
"extra": {
"parenthesizedArgument": false
}
},
"consequent": {
"type": "BlockStatement",
"start": 492,
"end": 529,
"loc": {
"start": {
"line": 26,
"column": 21
},
"end": {
"line": 28,
"column": 5
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 501,
"end": 522,
"loc": {
"start": {
"line": 27,
"column": 6
},
"end": {
"line": 27,
"column": 27
}
},
"expression": {
"type": "UnaryExpression",
"start": 501,
"end": 521,
"loc": {
"start": {
"line": 27,
"column": 6
},
"end": {
"line": 27,
"column": 26
}
},
"operator": "delete",
"prefix": true,
"argument": {
"type": "MemberExpression",
"start": 508,
"end": 521,
"loc": {
"start": {
"line": 27,
"column": 13
},
"end": {
"line": 27,
"column": 26
}
},
"object": {
"type": "MemberExpression",
"start": 508,
"end": 517,
"loc": {
"start": {
"line": 27,
"column": 13
},
"end": {
"line": 27,
"column": 22
}
},
"object": {
"type": "ThisExpression",
"start": 508,
"end": 512,
"loc": {
"start": {
"line": 27,
"column": 13
},
"end": {
"line": 27,
"column": 17
}
}
},
"property": {
"type": "Identifier",
"start": 513,
"end": 517,
"loc": {
"start": {
"line": 27,
"column": 18
},
"end": {
"line": 27,
"column": 22
},
"identifierName": "data"
},
"name": "data"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 518,
"end": 521,
"loc": {
"start": {
"line": 27,
"column": 23
},
"end": {
"line": 27,
"column": 26
},
"identifierName": "src"
},
"name": "src"
},
"computed": false
},
"extra": {
"parenthesizedArgument": false
}
}
}
],
"directives": []
},
"alternate": null
},
{
"type": "ExpressionStatement",
"start": 537,
"end": 553,
"loc": {
"start": {
"line": 30,
"column": 4
},
"end": {
"line": 30,
"column": 20
}
},
"expression": {
"type": "CallExpression",
"start": 537,
"end": 552,
"loc": {
"start": {
"line": 30,
"column": 4
},
"end": {
"line": 30,
"column": 19
}
},
"callee": {
"type": "MemberExpression",
"start": 537,
"end": 550,
"loc": {
"start": {
"line": 30,
"column": 4
},
"end": {
"line": 30,
"column": 17
}
},
"object": {
"type": "Super",
"start": 537,
"end": 542,
"loc": {
"start": {
"line": 30,
"column": 4
},
"end": {
"line": 30,
"column": 9
}
}
},
"property": {
"type": "Identifier",
"start": 543,
"end": 550,
"loc": {
"start": {
"line": 30,
"column": 10
},
"end": {
"line": 30,
"column": 17
},
"identifierName": "dispose"
},
"name": "dispose"
},
"computed": false
},
"arguments": []
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * @override\r\n ",
"start": 428,
"end": 454,
"loc": {
"start": {
"line": 22,
"column": 2
},
"end": {
"line": 24,
"column": 5
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * @override\r\n ",
"start": 564,
"end": 590,
"loc": {
"start": {
"line": 33,
"column": 2
},
"end": {
"line": 35,
"column": 5
}
}
}
]
},
{
"type": "ClassMethod",
"start": 594,
"end": 1477,
"loc": {
"start": {
"line": 36,
"column": 2
},
"end": {
"line": 63,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 594,
"end": 598,
"loc": {
"start": {
"line": 36,
"column": 2
},
"end": {
"line": 36,
"column": 6
},
"identifierName": "load"
},
"name": "load",
"leadingComments": null
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 601,
"end": 1477,
"loc": {
"start": {
"line": 36,
"column": 9
},
"end": {
"line": 63,
"column": 3
}
},
"body": [
{
"type": "VariableDeclaration",
"start": 608,
"end": 641,
"loc": {
"start": {
"line": 37,
"column": 4
},
"end": {
"line": 37,
"column": 37
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 614,
"end": 640,
"loc": {
"start": {
"line": 37,
"column": 10
},
"end": {
"line": 37,
"column": 36
}
},
"id": {
"type": "ObjectPattern",
"start": 614,
"end": 633,
"loc": {
"start": {
"line": 37,
"column": 10
},
"end": {
"line": 37,
"column": 29
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 616,
"end": 624,
"loc": {
"start": {
"line": 37,
"column": 12
},
"end": {
"line": 37,
"column": 20
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 616,
"end": 624,
"loc": {
"start": {
"line": 37,
"column": 12
},
"end": {
"line": 37,
"column": 20
},
"identifierName": "filename"
},
"name": "filename"
},
"value": {
"type": "Identifier",
"start": 616,
"end": 624,
"loc": {
"start": {
"line": 37,
"column": 12
},
"end": {
"line": 37,
"column": 20
},
"identifierName": "filename"
},
"name": "filename"
},
"extra": {
"shorthand": true
}
},
{
"type": "ObjectProperty",
"start": 626,
"end": 631,
"loc": {
"start": {
"line": 37,
"column": 22
},
"end": {
"line": 37,
"column": 27
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 626,
"end": 631,
"loc": {
"start": {
"line": 37,
"column": 22
},
"end": {
"line": 37,
"column": 27
},
"identifierName": "owner"
},
"name": "owner"
},
"value": {
"type": "Identifier",
"start": 626,
"end": 631,
"loc": {
"start": {
"line": 37,
"column": 22
},
"end": {
"line": 37,
"column": 27
},
"identifierName": "owner"
},
"name": "owner"
},
"extra": {
"shorthand": true
}
}
]
},
"init": {
"type": "ThisExpression",
"start": 636,
"end": 640,
"loc": {
"start": {
"line": 37,
"column": 32
},
"end": {
"line": 37,
"column": 36
}
}
}
}
],
"kind": "const"
},
{
"type": "ReturnStatement",
"start": 649,
"end": 1472,
"loc": {
"start": {
"line": 39,
"column": 4
},
"end": {
"line": 62,
"column": 10
}
},
"argument": {
"type": "CallExpression",
"start": 656,
"end": 1471,
"loc": {
"start": {
"line": 39,
"column": 11
},
"end": {
"line": 62,
"column": 9
}
},
"callee": {
"type": "MemberExpression",
"start": 656,
"end": 886,
"loc": {
"start": {
"line": 39,
"column": 11
},
"end": {
"line": 44,
"column": 11
}
},
"object": {
"type": "CallExpression",
"start": 656,
"end": 873,
"loc": {
"start": {
"line": 39,
"column": 11
},
"end": {
"line": 43,
"column": 7
}
},
"callee": {
"type": "MemberExpression",
"start": 656,
"end": 735,
"loc": {
"start": {
"line": 39,
"column": 11
},
"end": {
"line": 40,
"column": 11
}
},
"object": {
"type": "CallExpression",
"start": 656,
"end": 722,
"loc": {
"start": {
"line": 39,
"column": 11
},
"end": {
"line": 39,
"column": 77
}
},
"callee": {
"type": "MemberExpression",
"start": 656,
"end": 673,
"loc": {
"start": {
"line": 39,
"column": 11
},
"end": {
"line": 39,
"column": 28
}
},
"object": {
"type": "Identifier",
"start": 656,
"end": 661,
"loc": {
"start": {
"line": 39,
"column": 11
},
"end": {
"line": 39,
"column": 16
},
"identifierName": "owner"
},
"name": "owner"
},
"property": {
"type": "Identifier",
"start": 662,
"end": 673,
"loc": {
"start": {
"line": 39,
"column": 17
},
"end": {
"line": 39,
"column": 28
},
"identifierName": "fetchEngine"
},
"name": "fetchEngine"
},
"computed": false
},
"arguments": [
{
"type": "BinaryExpression",
"start": 674,
"end": 701,
"loc": {
"start": {
"line": 39,
"column": 29
},
"end": {
"line": 39,
"column": 56
}
},
"left": {
"type": "MemberExpression",
"start": 674,
"end": 690,
"loc": {
"start": {
"line": 39,
"column": 29
},
"end": {
"line": 39,
"column": 45
}
},
"object": {
"type": "Identifier",
"start": 674,
"end": 679,
"loc": {
"start": {
"line": 39,
"column": 29
},
"end": {
"line": 39,
"column": 34
},
"identifierName": "owner"
},
"name": "owner"
},
"property": {
"type": "Identifier",
"start": 680,
"end": 690,
"loc": {
"start": {
"line": 39,
"column": 35
},
"end": {
"line": 39,
"column": 45
},
"identifierName": "pathPrefix"
},
"name": "pathPrefix"
},
"computed": false
},
"operator": "+",
"right": {
"type": "Identifier",
"start": 693,
"end": 701,
"loc": {
"start": {
"line": 39,
"column": 48
},
"end": {
"line": 39,
"column": 56
},
"identifierName": "filename"
},
"name": "filename"
}
},
{
"type": "MemberExpression",
"start": 703,
"end": 721,
"loc": {
"start": {
"line": 39,
"column": 58
},
"end": {
"line": 39,
"column": 76
}
},
"object": {
"type": "Identifier",
"start": 703,
"end": 708,
"loc": {
"start": {
"line": 39,
"column": 58
},
"end": {
"line": 39,
"column": 63
},
"identifierName": "owner"
},
"name": "owner"
},
"property": {
"type": "Identifier",
"start": 709,
"end": 721,
"loc": {
"start": {
"line": 39,
"column": 64
},
"end": {
"line": 39,
"column": 76
},
"identifierName": "fetchOptions"
},
"name": "fetchOptions"
},
"computed": false
}
]
},
"property": {
"type": "Identifier",
"start": 731,
"end": 735,
"loc": {
"start": {
"line": 40,
"column": 7
},
"end": {
"line": 40,
"column": 11
},
"identifierName": "then"
},
"name": "then"
},
"computed": false
},
"arguments": [
{
"type": "ArrowFunctionExpression",
"start": 7