oxygen-core
Version:
Oxygen game engine (Xenon Core for browsers)
1,416 lines (1,415 loc) • 265 kB
JSON
{
"type": "File",
"start": 0,
"end": 2930,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 146,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 2930,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 146,
"column": 0
}
},
"sourceType": "module",
"body": [
{
"type": "ExportDefaultDeclaration",
"start": 64,
"end": 2928,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 145,
"column": 1
}
},
"declaration": {
"type": "ClassDeclaration",
"start": 79,
"end": 2928,
"loc": {
"start": {
"line": 4,
"column": 15
},
"end": {
"line": 145,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 85,
"end": 94,
"loc": {
"start": {
"line": 4,
"column": 21
},
"end": {
"line": 4,
"column": 30
},
"identifierName": "Component"
},
"name": "Component",
"leadingComments": null
},
"superClass": null,
"body": {
"type": "ClassBody",
"start": 95,
"end": 2928,
"loc": {
"start": {
"line": 4,
"column": 31
},
"end": {
"line": 145,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 122,
"end": 168,
"loc": {
"start": {
"line": 7,
"column": 2
},
"end": {
"line": 9,
"column": 3
}
},
"static": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 133,
"end": 143,
"loc": {
"start": {
"line": 7,
"column": 13
},
"end": {
"line": 7,
"column": 23
},
"identifierName": "propsTypes"
},
"name": "propsTypes"
},
"kind": "get",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 146,
"end": 168,
"loc": {
"start": {
"line": 7,
"column": 26
},
"end": {
"line": 9,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 153,
"end": 163,
"loc": {
"start": {
"line": 8,
"column": 4
},
"end": {
"line": 8,
"column": 14
}
},
"argument": {
"type": "ObjectExpression",
"start": 160,
"end": 162,
"loc": {
"start": {
"line": 8,
"column": 11
},
"end": {
"line": 8,
"column": 13
}
},
"properties": []
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "* @type {*} ",
"start": 102,
"end": 118,
"loc": {
"start": {
"line": 6,
"column": 2
},
"end": {
"line": 6,
"column": 18
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * Component factory.\r\n *\r\n * @return {Component} New component instance.\r\n ",
"start": 174,
"end": 265,
"loc": {
"start": {
"line": 11,
"column": 2
},
"end": {
"line": 15,
"column": 5
}
}
}
]
},
{
"type": "ClassMethod",
"start": 269,
"end": 345,
"loc": {
"start": {
"line": 16,
"column": 2
},
"end": {
"line": 18,
"column": 3
}
},
"static": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 276,
"end": 283,
"loc": {
"start": {
"line": 16,
"column": 9
},
"end": {
"line": 16,
"column": 16
},
"identifierName": "factory"
},
"name": "factory"
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 286,
"end": 345,
"loc": {
"start": {
"line": 16,
"column": 19
},
"end": {
"line": 18,
"column": 3
}
},
"body": [
{
"type": "ThrowStatement",
"start": 293,
"end": 340,
"loc": {
"start": {
"line": 17,
"column": 4
},
"end": {
"line": 17,
"column": 51
}
},
"argument": {
"type": "NewExpression",
"start": 299,
"end": 339,
"loc": {
"start": {
"line": 17,
"column": 10
},
"end": {
"line": 17,
"column": 50
}
},
"callee": {
"type": "Identifier",
"start": 303,
"end": 308,
"loc": {
"start": {
"line": 17,
"column": 14
},
"end": {
"line": 17,
"column": 19
},
"identifierName": "Error"
},
"name": "Error"
},
"arguments": [
{
"type": "StringLiteral",
"start": 309,
"end": 338,
"loc": {
"start": {
"line": 17,
"column": 20
},
"end": {
"line": 17,
"column": 49
}
},
"extra": {
"rawValue": "Factory is not implemented!",
"raw": "'Factory is not implemented!'"
},
"value": "Factory is not implemented!"
}
]
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * Component factory.\r\n *\r\n * @return {Component} New component instance.\r\n ",
"start": 174,
"end": 265,
"loc": {
"start": {
"line": 11,
"column": 2
},
"end": {
"line": 15,
"column": 5
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "* @type {Entity|null} ",
"start": 351,
"end": 377,
"loc": {
"start": {
"line": 20,
"column": 2
},
"end": {
"line": 20,
"column": 28
}
}
}
]
},
{
"type": "ClassMethod",
"start": 381,
"end": 425,
"loc": {
"start": {
"line": 21,
"column": 2
},
"end": {
"line": 23,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 385,
"end": 391,
"loc": {
"start": {
"line": 21,
"column": 6
},
"end": {
"line": 21,
"column": 12
},
"identifierName": "entity"
},
"name": "entity"
},
"kind": "get",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 394,
"end": 425,
"loc": {
"start": {
"line": 21,
"column": 15
},
"end": {
"line": 23,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 401,
"end": 420,
"loc": {
"start": {
"line": 22,
"column": 4
},
"end": {
"line": 22,
"column": 23
}
},
"argument": {
"type": "MemberExpression",
"start": 408,
"end": 419,
"loc": {
"start": {
"line": 22,
"column": 11
},
"end": {
"line": 22,
"column": 22
}
},
"object": {
"type": "ThisExpression",
"start": 408,
"end": 412,
"loc": {
"start": {
"line": 22,
"column": 11
},
"end": {
"line": 22,
"column": 15
}
}
},
"property": {
"type": "Identifier",
"start": 413,
"end": 419,
"loc": {
"start": {
"line": 22,
"column": 16
},
"end": {
"line": 22,
"column": 22
},
"identifierName": "_owner"
},
"name": "_owner"
},
"computed": false
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "* @type {Entity|null} ",
"start": 351,
"end": 377,
"loc": {
"start": {
"line": 20,
"column": 2
},
"end": {
"line": 20,
"column": 28
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * Constructor.\r\n ",
"start": 431,
"end": 460,
"loc": {
"start": {
"line": 25,
"column": 2
},
"end": {
"line": 27,
"column": 5
}
}
}
]
},
{
"type": "ClassMethod",
"start": 464,
"end": 509,
"loc": {
"start": {
"line": 28,
"column": 2
},
"end": {
"line": 30,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 464,
"end": 475,
"loc": {
"start": {
"line": 28,
"column": 2
},
"end": {
"line": 28,
"column": 13
},
"identifierName": "constructor"
},
"name": "constructor",
"leadingComments": null
},
"kind": "constructor",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 478,
"end": 509,
"loc": {
"start": {
"line": 28,
"column": 16
},
"end": {
"line": 30,
"column": 3
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 485,
"end": 504,
"loc": {
"start": {
"line": 29,
"column": 4
},
"end": {
"line": 29,
"column": 23
}
},
"expression": {
"type": "AssignmentExpression",
"start": 485,
"end": 503,
"loc": {
"start": {
"line": 29,
"column": 4
},
"end": {
"line": 29,
"column": 22
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 485,
"end": 496,
"loc": {
"start": {
"line": 29,
"column": 4
},
"end": {
"line": 29,
"column": 15
}
},
"object": {
"type": "ThisExpression",
"start": 485,
"end": 489,
"loc": {
"start": {
"line": 29,
"column": 4
},
"end": {
"line": 29,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 490,
"end": 496,
"loc": {
"start": {
"line": 29,
"column": 9
},
"end": {
"line": 29,
"column": 15
},
"identifierName": "_owner"
},
"name": "_owner"
},
"computed": false
},
"right": {
"type": "NullLiteral",
"start": 499,
"end": 503,
"loc": {
"start": {
"line": 29,
"column": 18
},
"end": {
"line": 29,
"column": 22
}
}
}
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * Constructor.\r\n ",
"start": 431,
"end": 460,
"loc": {
"start": {
"line": 25,
"column": 2
},
"end": {
"line": 27,
"column": 5
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * Destructor (dispose internal resources and detach from entity).\r\n *\r\n * @example\r\n * component.parent = system.root;\r\n * component.dispose();\r\n * component.parent === null;\r\n ",
"start": 515,
"end": 714,
"loc": {
"start": {
"line": 32,
"column": 2
},
"end": {
"line": 39,
"column": 5
}
}
}
]
},
{
"type": "ClassMethod",
"start": 718,
"end": 858,
"loc": {
"start": {
"line": 40,
"column": 2
},
"end": {
"line": 48,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 718,
"end": 725,
"loc": {
"start": {
"line": 40,
"column": 2
},
"end": {
"line": 40,
"column": 9
},
"identifierName": "dispose"
},
"name": "dispose",
"leadingComments": null
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 728,
"end": 858,
"loc": {
"start": {
"line": 40,
"column": 12
},
"end": {
"line": 48,
"column": 3
}
},
"body": [
{
"type": "VariableDeclaration",
"start": 735,
"end": 759,
"loc": {
"start": {
"line": 41,
"column": 4
},
"end": {
"line": 41,
"column": 28
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 741,
"end": 758,
"loc": {
"start": {
"line": 41,
"column": 10
},
"end": {
"line": 41,
"column": 27
}
},
"id": {
"type": "ObjectPattern",
"start": 741,
"end": 751,
"loc": {
"start": {
"line": 41,
"column": 10
},
"end": {
"line": 41,
"column": 20
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 743,
"end": 749,
"loc": {
"start": {
"line": 41,
"column": 12
},
"end": {
"line": 41,
"column": 18
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 743,
"end": 749,
"loc": {
"start": {
"line": 41,
"column": 12
},
"end": {
"line": 41,
"column": 18
},
"identifierName": "_owner"
},
"name": "_owner"
},
"value": {
"type": "Identifier",
"start": 743,
"end": 749,
"loc": {
"start": {
"line": 41,
"column": 12
},
"end": {
"line": 41,
"column": 18
},
"identifierName": "_owner"
},
"name": "_owner"
},
"extra": {
"shorthand": true
}
}
]
},
"init": {
"type": "ThisExpression",
"start": 754,
"end": 758,
"loc": {
"start": {
"line": 41,
"column": 23
},
"end": {
"line": 41,
"column": 27
}
}
}
}
],
"kind": "const"
},
{
"type": "IfStatement",
"start": 767,
"end": 826,
"loc": {
"start": {
"line": 43,
"column": 4
},
"end": {
"line": 45,
"column": 5
}
},
"test": {
"type": "UnaryExpression",
"start": 771,
"end": 779,
"loc": {
"start": {
"line": 43,
"column": 8
},
"end": {
"line": 43,
"column": 16
}
},
"operator": "!",
"prefix": true,
"argument": {
"type": "UnaryExpression",
"start": 772,
"end": 779,
"loc": {
"start": {
"line": 43,
"column": 9
},
"end": {
"line": 43,
"column": 16
}
},
"operator": "!",
"prefix": true,
"argument": {
"type": "Identifier",
"start": 773,
"end": 779,
"loc": {
"start": {
"line": 43,
"column": 10
},
"end": {
"line": 43,
"column": 16
},
"identifierName": "_owner"
},
"name": "_owner"
},
"extra": {
"parenthesizedArgument": false
}
},
"extra": {
"parenthesizedArgument": false
}
},
"consequent": {
"type": "BlockStatement",
"start": 781,
"end": 826,
"loc": {
"start": {
"line": 43,
"column": 18
},
"end": {
"line": 45,
"column": 5
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 790,
"end": 819,
"loc": {
"start": {
"line": 44,
"column": 6
},
"end": {
"line": 44,
"column": 35
}
},
"expression": {
"type": "CallExpression",
"start": 790,
"end": 818,
"loc": {
"start": {
"line": 44,
"column": 6
},
"end": {
"line": 44,
"column": 34
}
},
"callee": {
"type": "MemberExpression",
"start": 790,
"end": 812,
"loc": {
"start": {
"line": 44,
"column": 6
},
"end": {
"line": 44,
"column": 28
}
},
"object": {
"type": "Identifier",
"start": 790,
"end": 796,
"loc": {
"start": {
"line": 44,
"column": 6
},
"end": {
"line": 44,
"column": 12
},
"identifierName": "_owner"
},
"name": "_owner"
},
"property": {
"type": "Identifier",
"start": 797,
"end": 812,
"loc": {
"start": {
"line": 44,
"column": 13
},
"end": {
"line": 44,
"column": 28
},
"identifierName": "detachComponent"
},
"name": "detachComponent"
},
"computed": false
},
"arguments": [
{
"type": "ThisExpression",
"start": 813,
"end": 817,
"loc": {
"start": {
"line": 44,
"column": 29
},
"end": {
"line": 44,
"column": 33
}
}
}
]
}
}
],
"directives": []
},
"alternate": null
},
{
"type": "ExpressionStatement",
"start": 834,
"end": 853,
"loc": {
"start": {
"line": 47,
"column": 4
},
"end": {
"line": 47,
"column": 23
}
},
"expression": {
"type": "AssignmentExpression",
"start": 834,
"end": 852,
"loc": {
"start": {
"line": 47,
"column": 4
},
"end": {
"line": 47,
"column": 22
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 834,
"end": 845,
"loc": {
"start": {
"line": 47,
"column": 4
},
"end": {
"line": 47,
"column": 15
}
},
"object": {
"type": "ThisExpression",
"start": 834,
"end": 838,
"loc": {
"start": {
"line": 47,
"column": 4
},
"end": {
"line": 47,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 839,
"end": 845,
"loc": {
"start": {
"line": 47,
"column": 9
},
"end": {
"line": 47,
"column": 15
},
"identifierName": "_owner"
},
"name": "_owner"
},
"computed": false
},
"right": {
"type": "NullLiteral",
"start": 848,
"end": 852,
"loc": {
"start": {
"line": 47,
"column": 18
},
"end": {
"line": 47,
"column": 22
}
}
}
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * Destructor (dispose internal resources and detach from entity).\r\n *\r\n * @example\r\n * component.parent = system.root;\r\n * component.dispose();\r\n * component.parent === null;\r\n ",
"start": 515,
"end": 714,
"loc": {
"start": {
"line": 32,
"column": 2
},
"end": {
"line": 39,
"column": 5
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * Serialize component into JSON data.\r\n *\r\n * @return {*} Serialized JSON data.\r\n *\r\n * @example\r\n * component.hello = 'world';\r\n * const json = component.serialize();\r\n * json.hello === 'world';\r\n ",
"start": 864,
"end": 1088,
"loc": {
"start": {
"line": 50,
"column": 2
},
"end": {
"line": 59,
"column": 5
}
}
}
]
},
{
"type": "ClassMethod",
"start": 1092,
"end": 1430,
"loc": {
"start": {
"line": 60,
"column": 2
},
"end": {
"line": 74,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 1092,
"end": 1101,
"loc": {
"start": {
"line": 60,
"column": 2
},
"end": {
"line": 60,
"column": 11
},
"identifierName": "serialize"
},
"name": "serialize",
"leadingComments": null
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 1104,
"end": 1430,
"loc": {
"start": {
"line": 60,
"column": 14
},
"end": {
"line": 74,
"column": 3
}
},
"body": [
{
"type": "VariableDeclaration",
"start": 1111,
"end": 1151,
"loc": {
"start": {
"line": 61,
"column": 4
},
"end": {
"line": 61,
"column": 44
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 1117,
"end": 1150,
"loc": {
"start": {
"line": 61,
"column": 10
},
"end": {
"line": 61,
"column": 43
}
},
"id": {
"type": "ObjectPattern",
"start": 1117,
"end": 1131,
"loc": {
"start": {
"line": 61,
"column": 10
},
"end": {
"line": 61,
"column": 24
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 1119,
"end": 1129,
"loc": {
"start": {
"line": 61,
"column": 12
},
"end": {
"line": 61,
"column": 22
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 1119,
"end": 1129,
"loc": {
"start": {
"line": 61,
"column": 12
},
"end": {
"line": 61,
"column": 22
},
"identifierName": "propsTypes"
},
"name": "propsTypes"
},
"value": {
"type": "Identifier",
"start": 1119,
"end": 1129,
"loc": {
"start": {
"line": 61,
"column": 12
},
"end": {
"line": 61,
"column": 22
},
"identifierName": "propsTypes"
},
"name": "propsTypes"
},
"extra": {
"shorthand": true
}
}
]
},
"init": {
"type": "MemberExpression",
"start": 1134,
"end": 1150,
"loc": {
"start": {
"line": 61,
"column": 27
},
"end": {
"line": 61,
"column": 43
}
},
"object": {
"type": "ThisExpression",
"start": 1134,
"end": 1138,
"loc": {
"start": {
"line": 61,
"column": 27
},
"end": {
"line": 61,
"column": 31
}
}
},
"property": {
"type": "Identifier",