oxygen-core
Version:
Oxygen game engine (Xenon Core for browsers)
1,393 lines • 740 kB
JSON
{
"type": "File",
"start": 0,
"end": 4704,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 202,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 4704,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 202,
"column": 0
}
},
"sourceType": "module",
"body": [
{
"type": "ExportDefaultDeclaration",
"start": 214,
"end": 4702,
"loc": {
"start": {
"line": 11,
"column": 0
},
"end": {
"line": 201,
"column": 1
}
},
"declaration": {
"type": "ClassDeclaration",
"start": 229,
"end": 4702,
"loc": {
"start": {
"line": 11,
"column": 15
},
"end": {
"line": 201,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 235,
"end": 241,
"loc": {
"start": {
"line": 11,
"column": 21
},
"end": {
"line": 11,
"column": 27
},
"identifierName": "Events"
},
"name": "Events",
"leadingComments": null
},
"superClass": null,
"body": {
"type": "ClassBody",
"start": 242,
"end": 4702,
"loc": {
"start": {
"line": 11,
"column": 28
},
"end": {
"line": 201,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 282,
"end": 413,
"loc": {
"start": {
"line": 16,
"column": 2
},
"end": {
"line": 21,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 282,
"end": 293,
"loc": {
"start": {
"line": 16,
"column": 2
},
"end": {
"line": 16,
"column": 13
},
"identifierName": "constructor"
},
"name": "constructor",
"leadingComments": null
},
"kind": "constructor",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 296,
"end": 413,
"loc": {
"start": {
"line": 16,
"column": 16
},
"end": {
"line": 21,
"column": 3
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 303,
"end": 328,
"loc": {
"start": {
"line": 17,
"column": 4
},
"end": {
"line": 17,
"column": 29
}
},
"expression": {
"type": "AssignmentExpression",
"start": 303,
"end": 327,
"loc": {
"start": {
"line": 17,
"column": 4
},
"end": {
"line": 17,
"column": 28
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 303,
"end": 315,
"loc": {
"start": {
"line": 17,
"column": 4
},
"end": {
"line": 17,
"column": 16
}
},
"object": {
"type": "ThisExpression",
"start": 303,
"end": 307,
"loc": {
"start": {
"line": 17,
"column": 4
},
"end": {
"line": 17,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 308,
"end": 315,
"loc": {
"start": {
"line": 17,
"column": 9
},
"end": {
"line": 17,
"column": 16
},
"identifierName": "_events"
},
"name": "_events"
},
"computed": false
},
"right": {
"type": "NewExpression",
"start": 318,
"end": 327,
"loc": {
"start": {
"line": 17,
"column": 19
},
"end": {
"line": 17,
"column": 28
}
},
"callee": {
"type": "Identifier",
"start": 322,
"end": 325,
"loc": {
"start": {
"line": 17,
"column": 23
},
"end": {
"line": 17,
"column": 26
},
"identifierName": "Map"
},
"name": "Map"
},
"arguments": []
}
}
},
{
"type": "ExpressionStatement",
"start": 334,
"end": 353,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 18,
"column": 23
}
},
"expression": {
"type": "AssignmentExpression",
"start": 334,
"end": 352,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 18,
"column": 22
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 334,
"end": 347,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 18,
"column": 17
}
},
"object": {
"type": "ThisExpression",
"start": 334,
"end": 338,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 18,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 339,
"end": 347,
"loc": {
"start": {
"line": 18,
"column": 9
},
"end": {
"line": 18,
"column": 17
},
"identifierName": "_onQueue"
},
"name": "_onQueue"
},
"computed": false
},
"right": {
"type": "ArrayExpression",
"start": 350,
"end": 352,
"loc": {
"start": {
"line": 18,
"column": 20
},
"end": {
"line": 18,
"column": 22
}
},
"elements": []
}
}
},
{
"type": "ExpressionStatement",
"start": 359,
"end": 379,
"loc": {
"start": {
"line": 19,
"column": 4
},
"end": {
"line": 19,
"column": 24
}
},
"expression": {
"type": "AssignmentExpression",
"start": 359,
"end": 378,
"loc": {
"start": {
"line": 19,
"column": 4
},
"end": {
"line": 19,
"column": 23
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 359,
"end": 373,
"loc": {
"start": {
"line": 19,
"column": 4
},
"end": {
"line": 19,
"column": 18
}
},
"object": {
"type": "ThisExpression",
"start": 359,
"end": 363,
"loc": {
"start": {
"line": 19,
"column": 4
},
"end": {
"line": 19,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 364,
"end": 373,
"loc": {
"start": {
"line": 19,
"column": 9
},
"end": {
"line": 19,
"column": 18
},
"identifierName": "_offQueue"
},
"name": "_offQueue"
},
"computed": false
},
"right": {
"type": "ArrayExpression",
"start": 376,
"end": 378,
"loc": {
"start": {
"line": 19,
"column": 21
},
"end": {
"line": 19,
"column": 23
}
},
"elements": []
}
}
},
{
"type": "ExpressionStatement",
"start": 385,
"end": 408,
"loc": {
"start": {
"line": 20,
"column": 4
},
"end": {
"line": 20,
"column": 27
}
},
"expression": {
"type": "AssignmentExpression",
"start": 385,
"end": 407,
"loc": {
"start": {
"line": 20,
"column": 4
},
"end": {
"line": 20,
"column": 26
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 385,
"end": 403,
"loc": {
"start": {
"line": 20,
"column": 4
},
"end": {
"line": 20,
"column": 22
}
},
"object": {
"type": "ThisExpression",
"start": 385,
"end": 389,
"loc": {
"start": {
"line": 20,
"column": 4
},
"end": {
"line": 20,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 390,
"end": 403,
"loc": {
"start": {
"line": 20,
"column": 9
},
"end": {
"line": 20,
"column": 22
},
"identifierName": "_triggerDepth"
},
"name": "_triggerDepth"
},
"computed": false
},
"right": {
"type": "NumericLiteral",
"start": 406,
"end": 407,
"loc": {
"start": {
"line": 20,
"column": 25
},
"end": {
"line": 20,
"column": 26
}
},
"extra": {
"rawValue": 0,
"raw": "0"
},
"value": 0
}
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * Constructor.\r\n ",
"start": 249,
"end": 278,
"loc": {
"start": {
"line": 13,
"column": 2
},
"end": {
"line": 15,
"column": 5
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * Destructor (disposes internal resources).\r\n *\r\n * @example\r\n * events.dispose();\r\n * events = null;\r\n ",
"start": 419,
"end": 543,
"loc": {
"start": {
"line": 23,
"column": 2
},
"end": {
"line": 29,
"column": 5
}
}
}
]
},
{
"type": "ClassMethod",
"start": 547,
"end": 670,
"loc": {
"start": {
"line": 30,
"column": 2
},
"end": {
"line": 35,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 547,
"end": 554,
"loc": {
"start": {
"line": 30,
"column": 2
},
"end": {
"line": 30,
"column": 9
},
"identifierName": "dispose"
},
"name": "dispose",
"leadingComments": null
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 557,
"end": 670,
"loc": {
"start": {
"line": 30,
"column": 12
},
"end": {
"line": 35,
"column": 3
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 564,
"end": 585,
"loc": {
"start": {
"line": 31,
"column": 4
},
"end": {
"line": 31,
"column": 25
}
},
"expression": {
"type": "CallExpression",
"start": 564,
"end": 584,
"loc": {
"start": {
"line": 31,
"column": 4
},
"end": {
"line": 31,
"column": 24
}
},
"callee": {
"type": "MemberExpression",
"start": 564,
"end": 582,
"loc": {
"start": {
"line": 31,
"column": 4
},
"end": {
"line": 31,
"column": 22
}
},
"object": {
"type": "MemberExpression",
"start": 564,
"end": 576,
"loc": {
"start": {
"line": 31,
"column": 4
},
"end": {
"line": 31,
"column": 16
}
},
"object": {
"type": "ThisExpression",
"start": 564,
"end": 568,
"loc": {
"start": {
"line": 31,
"column": 4
},
"end": {
"line": 31,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 569,
"end": 576,
"loc": {
"start": {
"line": 31,
"column": 9
},
"end": {
"line": 31,
"column": 16
},
"identifierName": "_events"
},
"name": "_events"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 577,
"end": 582,
"loc": {
"start": {
"line": 31,
"column": 17
},
"end": {
"line": 31,
"column": 22
},
"identifierName": "clear"
},
"name": "clear"
},
"computed": false
},
"arguments": []
}
},
{
"type": "ExpressionStatement",
"start": 591,
"end": 610,
"loc": {
"start": {
"line": 32,
"column": 4
},
"end": {
"line": 32,
"column": 23
}
},
"expression": {
"type": "AssignmentExpression",
"start": 591,
"end": 609,
"loc": {
"start": {
"line": 32,
"column": 4
},
"end": {
"line": 32,
"column": 22
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 591,
"end": 604,
"loc": {
"start": {
"line": 32,
"column": 4
},
"end": {
"line": 32,
"column": 17
}
},
"object": {
"type": "ThisExpression",
"start": 591,
"end": 595,
"loc": {
"start": {
"line": 32,
"column": 4
},
"end": {
"line": 32,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 596,
"end": 604,
"loc": {
"start": {
"line": 32,
"column": 9
},
"end": {
"line": 32,
"column": 17
},
"identifierName": "_onQueue"
},
"name": "_onQueue"
},
"computed": false
},
"right": {
"type": "ArrayExpression",
"start": 607,
"end": 609,
"loc": {
"start": {
"line": 32,
"column": 20
},
"end": {
"line": 32,
"column": 22
}
},
"elements": []
}
}
},
{
"type": "ExpressionStatement",
"start": 616,
"end": 636,
"loc": {
"start": {
"line": 33,
"column": 4
},
"end": {
"line": 33,
"column": 24
}
},
"expression": {
"type": "AssignmentExpression",
"start": 616,
"end": 635,
"loc": {
"start": {
"line": 33,
"column": 4
},
"end": {
"line": 33,
"column": 23
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 616,
"end": 630,
"loc": {
"start": {
"line": 33,
"column": 4
},
"end": {
"line": 33,
"column": 18
}
},
"object": {
"type": "ThisExpression",
"start": 616,
"end": 620,
"loc": {
"start": {
"line": 33,
"column": 4
},
"end": {
"line": 33,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 621,
"end": 630,
"loc": {
"start": {
"line": 33,
"column": 9
},
"end": {
"line": 33,
"column": 18
},
"identifierName": "_offQueue"
},
"name": "_offQueue"
},
"computed": false
},
"right": {
"type": "ArrayExpression",
"start": 633,
"end": 635,
"loc": {
"start": {
"line": 33,
"column": 21
},
"end": {
"line": 33,
"column": 23
}
},
"elements": []
}
}
},
{
"type": "ExpressionStatement",
"start": 642,
"end": 665,
"loc": {
"start": {
"line": 34,
"column": 4
},
"end": {
"line": 34,
"column": 27
}
},
"expression": {
"type": "AssignmentExpression",
"start": 642,
"end": 664,
"loc": {
"start": {
"line": 34,
"column": 4
},
"end": {
"line": 34,
"column": 26
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 642,
"end": 660,
"loc": {
"start": {
"line": 34,
"column": 4
},
"end": {
"line": 34,
"column": 22
}
},
"object": {
"type": "ThisExpression",
"start": 642,
"end": 646,
"loc": {
"start": {
"line": 34,
"column": 4
},
"end": {
"line": 34,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 647,
"end": 660,
"loc": {
"start": {
"line": 34,
"column": 9
},
"end": {
"line": 34,
"column": 22
},
"identifierName": "_triggerDepth"
},
"name": "_triggerDepth"
},
"computed": false
},
"right": {
"type": "NumericLiteral",
"start": 663,
"end": 664,
"loc": {
"start": {
"line": 34,
"column": 25
},
"end": {
"line": 34,
"column": 26
}
},
"extra": {
"rawValue": 0,
"raw": "0"
},
"value": 0
}
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * Destructor (disposes internal resources).\r\n *\r\n * @example\r\n * events.dispose();\r\n * events = null;\r\n ",
"start": 419,
"end": 543,
"loc": {
"start": {
"line": 23,
"column": 2
},
"end": {
"line": 29,
"column": 5
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * Listen for given event.\r\n *\r\n * @param {string}\tname - Event name.\r\n * @param {Function}\tcallback - Event callback. Arguments are passed here from trigger methods.\r\n *\r\n * @example\r\n * events.on('hello', wat => console.log(wat));\r\n * events.trigger('hello', 'world');\r\n ",
"start": 676,
"end": 974,
"loc": {
"start": {
"line": 37,
"column": 2
},
"end": {
"line": 46,
"column": 5
}
}
}
]
},
{
"type": "ClassMethod",
"start": 978,
"end": 1482,
"loc": {
"start": {
"line": 47,
"column": 2
},
"end": {
"line": 67,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 978,
"end": 980,
"loc": {
"start": {
"line": 47,
"column": 2
},
"end": {
"line": 47,
"column": 4
},
"identifierName": "on"
},
"name": "on",
"leadingComments": null
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 981,
"end": 985,
"loc": {
"start": {
"line": 47,
"column": 5
},
"end": {
"line": 47,
"column": 9
},
"identifierName": "name"
},
"name": "name"
},
{
"type": "Identifier",
"start": 987,
"end": 995,
"loc": {
"start": {
"line": 47,
"column": 11
},
"end": {
"line": 47,
"column": 19
},
"identifierName": "callback"
},
"name": "callback"
}
],
"body": {
"type": "BlockStatement",
"start": 997,
"end": 1482,
"loc": {
"start": {
"line": 47,
"column": 21
},
"end": {
"line": 67,
"column": 3
}
},
"body": [
{
"type": "IfStatement",
"start": 1004,
"end": 1099,
"loc": {
"start": {
"line": 48,
"column": 4
},
"end": {
"line": 50,
"column": 5
}
},
"test": {
"type": "BinaryExpression",
"start": 1008,
"end": 1032,
"loc": {
"start": {
"line": 48,
"column": 8
},
"end": {
"line": 48,
"column": 32
}
},
"left": {
"type": "UnaryExpression",
"start": 1008,
"end": 1019,
"loc": {
"start": {
"line": 48,
"column": 8
},
"end": {
"line": 48,
"column": 19
}
},
"operator": "typeof",
"prefix": true,
"argument": {
"type": "Identifier",
"start": 1015,
"end": 1019,
"loc": {
"start": {
"line": 48,
"column": 15
},
"end": {
"line": 48,
"column": 19
},
"identifierName": "name"
},
"name": "name"
},
"extra": {
"parenthesizedArgument": false
}
},
"operator": "!==",
"right": {
"type": "StringLiteral",
"start": 1024,
"end": 1032,
"loc": {
"start": {
"line": 48,
"column": 24
},
"end": {
"line": 48,
"column": 32
}
},
"extra": {
"rawValue": "string",
"raw": "'string'"
},
"value": "string"
}
},
"consequent": {
"type": "BlockStatement",
"start": 1034,
"end": 1099,
"loc": {
"start": {
"line": 48,
"column": 34
},
"end": {
"line": 50,
"column": 5
}
},
"body": [
{
"type": "ThrowStatement",
"start": 1043,
"end": 1092,
"loc": {
"start": {
"line": 49,
"column": 6
},
"end": {
"line": 49,
"column": 55
}
},
"argument": {
"type": "NewExpression",
"start": 1049,
"end": 1091,
"loc": {
"start": {
"line": 49,
"column": 12
},
"end": {
"line": 49,
"column": 54
}
},
"callee": {
"type": "Identifier",
"start": 1053,
"end": 1058,
"loc": {
"start": {
"line": 49,
"column": 16
},
"end": {
"line": 49,
"column": 21
},
"identifierName": "Error"
},
"name": "Error"
},
"arguments": [
{
"type": "StringLiteral",
"start": 1059,
"end": 1090,
"loc": {
"start": {
"line": 49,
"column": 22
},
"end": {
"line": 49,
"column": 53
}
},
"extra": {
"rawValue": "`name` is not type of String!",
"raw": "'`name` is not type of String!'"
},
"value": "`name` is not type of String!"
}
]
}
}
],
"directives": []
},
"alternate": null
},
{
"type": "IfStatement",
"start": 1105,
"end": 1213,
"loc": {
"start": {
"line": 51,
"column": 4
},
"end": {
"line": 53,
"column": 5
}
},
"test": {
"type": "UnaryExpression",
"start": 1109,
"end": 1140,
"loc": {
"start": {
"line": 51,
"column": 8
},
"end": {
"line": 51,
"column": 39
}
},
"operator": "!",
"prefix": true,
"argument": {
"type": "BinaryExpression",
"start": 1111,
"end": 1139,
"loc": {
"start": {
"line": 51,
"column": 10
},
"end": {
"line": 51,