oxygen-core
Version:
Oxygen game engine (Xenon Core for browsers)
1,553 lines (1,552 loc) • 1.13 MB
JSON
{
"type": "File",
"start": 0,
"end": 7659,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 323,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 7659,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 323,
"column": 0
}
},
"sourceType": "module",
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 30,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 30
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 7,
"end": 13,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 13
}
},
"local": {
"type": "Identifier",
"start": 7,
"end": 13,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 13
},
"identifierName": "System"
},
"name": "System"
}
}
],
"source": {
"type": "StringLiteral",
"start": 19,
"end": 29,
"loc": {
"start": {
"line": 1,
"column": 19
},
"end": {
"line": 1,
"column": 29
}
},
"extra": {
"rawValue": "./System",
"raw": "'./System'"
},
"value": "./System"
}
},
{
"type": "ImportDeclaration",
"start": 32,
"end": 69,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 37
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 39,
"end": 45,
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 13
}
},
"local": {
"type": "Identifier",
"start": 39,
"end": 45,
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 13
},
"identifierName": "Events"
},
"name": "Events"
}
}
],
"source": {
"type": "StringLiteral",
"start": 51,
"end": 68,
"loc": {
"start": {
"line": 2,
"column": 19
},
"end": {
"line": 2,
"column": 36
}
},
"extra": {
"rawValue": "../utils/Events",
"raw": "'../utils/Events'"
},
"value": "../utils/Events"
}
},
{
"type": "VariableDeclaration",
"start": 73,
"end": 143,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 4,
"column": 70
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 79,
"end": 142,
"loc": {
"start": {
"line": 4,
"column": 6
},
"end": {
"line": 4,
"column": 69
}
},
"id": {
"type": "Identifier",
"start": 79,
"end": 91,
"loc": {
"start": {
"line": 4,
"column": 6
},
"end": {
"line": 4,
"column": 18
},
"identifierName": "audioContext"
},
"name": "audioContext"
},
"init": {
"type": "LogicalExpression",
"start": 94,
"end": 142,
"loc": {
"start": {
"line": 4,
"column": 21
},
"end": {
"line": 4,
"column": 69
}
},
"left": {
"type": "MemberExpression",
"start": 94,
"end": 113,
"loc": {
"start": {
"line": 4,
"column": 21
},
"end": {
"line": 4,
"column": 40
}
},
"object": {
"type": "Identifier",
"start": 94,
"end": 100,
"loc": {
"start": {
"line": 4,
"column": 21
},
"end": {
"line": 4,
"column": 27
},
"identifierName": "window"
},
"name": "window"
},
"property": {
"type": "Identifier",
"start": 101,
"end": 113,
"loc": {
"start": {
"line": 4,
"column": 28
},
"end": {
"line": 4,
"column": 40
},
"identifierName": "AudioContext"
},
"name": "AudioContext"
},
"computed": false
},
"operator": "||",
"right": {
"type": "MemberExpression",
"start": 117,
"end": 142,
"loc": {
"start": {
"line": 4,
"column": 44
},
"end": {
"line": 4,
"column": 69
}
},
"object": {
"type": "Identifier",
"start": 117,
"end": 123,
"loc": {
"start": {
"line": 4,
"column": 44
},
"end": {
"line": 4,
"column": 50
},
"identifierName": "window"
},
"name": "window"
},
"property": {
"type": "Identifier",
"start": 124,
"end": 142,
"loc": {
"start": {
"line": 4,
"column": 51
},
"end": {
"line": 4,
"column": 69
},
"identifierName": "webkitAudioContext"
},
"name": "webkitAudioContext"
},
"computed": false
}
}
}
],
"kind": "const",
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * System used to manage audio.\r\n *\r\n * @example\r\n * const system = new AudioSystem();\r\n ",
"start": 147,
"end": 243,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 11,
"column": 3
}
}
}
]
},
{
"type": "ExportDefaultDeclaration",
"start": 245,
"end": 7657,
"loc": {
"start": {
"line": 12,
"column": 0
},
"end": {
"line": 322,
"column": 1
}
},
"declaration": {
"type": "ClassDeclaration",
"start": 260,
"end": 7657,
"loc": {
"start": {
"line": 12,
"column": 15
},
"end": {
"line": 322,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 266,
"end": 277,
"loc": {
"start": {
"line": 12,
"column": 21
},
"end": {
"line": 12,
"column": 32
},
"identifierName": "AudioSystem"
},
"name": "AudioSystem",
"leadingComments": null
},
"superClass": {
"type": "Identifier",
"start": 286,
"end": 292,
"loc": {
"start": {
"line": 12,
"column": 41
},
"end": {
"line": 12,
"column": 47
},
"identifierName": "System"
},
"name": "System"
},
"body": {
"type": "ClassBody",
"start": 293,
"end": 7657,
"loc": {
"start": {
"line": 12,
"column": 48
},
"end": {
"line": 322,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 331,
"end": 378,
"loc": {
"start": {
"line": 15,
"column": 2
},
"end": {
"line": 17,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 335,
"end": 342,
"loc": {
"start": {
"line": 15,
"column": 6
},
"end": {
"line": 15,
"column": 13
},
"identifierName": "context"
},
"name": "context"
},
"kind": "get",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 345,
"end": 378,
"loc": {
"start": {
"line": 15,
"column": 16
},
"end": {
"line": 17,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 352,
"end": 373,
"loc": {
"start": {
"line": 16,
"column": 4
},
"end": {
"line": 16,
"column": 25
}
},
"argument": {
"type": "MemberExpression",
"start": 359,
"end": 372,
"loc": {
"start": {
"line": 16,
"column": 11
},
"end": {
"line": 16,
"column": 24
}
},
"object": {
"type": "ThisExpression",
"start": 359,
"end": 363,
"loc": {
"start": {
"line": 16,
"column": 11
},
"end": {
"line": 16,
"column": 15
}
}
},
"property": {
"type": "Identifier",
"start": 364,
"end": 372,
"loc": {
"start": {
"line": 16,
"column": 16
},
"end": {
"line": 16,
"column": 24
},
"identifierName": "_context"
},
"name": "_context"
},
"computed": false
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "* @type {AudioContext} ",
"start": 300,
"end": 327,
"loc": {
"start": {
"line": 14,
"column": 2
},
"end": {
"line": 14,
"column": 29
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "* @type {Events} ",
"start": 384,
"end": 405,
"loc": {
"start": {
"line": 19,
"column": 2
},
"end": {
"line": 19,
"column": 23
}
}
}
]
},
{
"type": "ClassMethod",
"start": 409,
"end": 454,
"loc": {
"start": {
"line": 20,
"column": 2
},
"end": {
"line": 22,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 413,
"end": 419,
"loc": {
"start": {
"line": 20,
"column": 6
},
"end": {
"line": 20,
"column": 12
},
"identifierName": "events"
},
"name": "events"
},
"kind": "get",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 422,
"end": 454,
"loc": {
"start": {
"line": 20,
"column": 15
},
"end": {
"line": 22,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 429,
"end": 449,
"loc": {
"start": {
"line": 21,
"column": 4
},
"end": {
"line": 21,
"column": 24
}
},
"argument": {
"type": "MemberExpression",
"start": 436,
"end": 448,
"loc": {
"start": {
"line": 21,
"column": 11
},
"end": {
"line": 21,
"column": 23
}
},
"object": {
"type": "ThisExpression",
"start": 436,
"end": 440,
"loc": {
"start": {
"line": 21,
"column": 11
},
"end": {
"line": 21,
"column": 15
}
}
},
"property": {
"type": "Identifier",
"start": 441,
"end": 448,
"loc": {
"start": {
"line": 21,
"column": 16
},
"end": {
"line": 21,
"column": 23
},
"identifierName": "_events"
},
"name": "_events"
},
"computed": false
}
}
],
"directives": []
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "* @type {Events} ",
"start": 384,
"end": 405,
"loc": {
"start": {
"line": 19,
"column": 2
},
"end": {
"line": 19,
"column": 23
}
}
}
]
},
{
"type": "ClassMethod",
"start": 460,
"end": 526,
"loc": {
"start": {
"line": 24,
"column": 2
},
"end": {
"line": 26,
"column": 3
}
},
"static": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 467,
"end": 485,
"loc": {
"start": {
"line": 24,
"column": 9
},
"end": {
"line": 24,
"column": 27
},
"identifierName": "createAudioContext"
},
"name": "createAudioContext"
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 488,
"end": 526,
"loc": {
"start": {
"line": 24,
"column": 30
},
"end": {
"line": 26,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 495,
"end": 521,
"loc": {
"start": {
"line": 25,
"column": 4
},
"end": {
"line": 25,
"column": 30
}
},
"argument": {
"type": "NewExpression",
"start": 502,
"end": 520,
"loc": {
"start": {
"line": 25,
"column": 11
},
"end": {
"line": 25,
"column": 29
}
},
"callee": {
"type": "Identifier",
"start": 506,
"end": 518,
"loc": {
"start": {
"line": 25,
"column": 15
},
"end": {
"line": 25,
"column": 27
},
"identifierName": "audioContext"
},
"name": "audioContext"
},
"arguments": []
}
}
],
"directives": [],
"trailingComments": null
},
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * Constructor.\r\n ",
"start": 532,
"end": 561,
"loc": {
"start": {
"line": 28,
"column": 2
},
"end": {
"line": 30,
"column": 5
}
}
}
]
},
{
"type": "ClassMethod",
"start": 565,
"end": 752,
"loc": {
"start": {
"line": 31,
"column": 2
},
"end": {
"line": 38,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 565,
"end": 576,
"loc": {
"start": {
"line": 31,
"column": 2
},
"end": {
"line": 31,
"column": 13
},
"identifierName": "constructor"
},
"name": "constructor",
"leadingComments": null
},
"kind": "constructor",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 579,
"end": 752,
"loc": {
"start": {
"line": 31,
"column": 16
},
"end": {
"line": 38,
"column": 3
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 586,
"end": 594,
"loc": {
"start": {
"line": 32,
"column": 4
},
"end": {
"line": 32,
"column": 12
}
},
"expression": {
"type": "CallExpression",
"start": 586,
"end": 593,
"loc": {
"start": {
"line": 32,
"column": 4
},
"end": {
"line": 32,
"column": 11
}
},
"callee": {
"type": "Super",
"start": 586,
"end": 591,
"loc": {
"start": {
"line": 32,
"column": 4
},
"end": {
"line": 32,
"column": 9
}
}
},
"arguments": []
}
},
{
"type": "ExpressionStatement",
"start": 602,
"end": 651,
"loc": {
"start": {
"line": 34,
"column": 4
},
"end": {
"line": 34,
"column": 53
}
},
"expression": {
"type": "AssignmentExpression",
"start": 602,
"end": 650,
"loc": {
"start": {
"line": 34,
"column": 4
},
"end": {
"line": 34,
"column": 52
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 602,
"end": 615,
"loc": {
"start": {
"line": 34,
"column": 4
},
"end": {
"line": 34,
"column": 17
}
},
"object": {
"type": "ThisExpression",
"start": 602,
"end": 606,
"loc": {
"start": {
"line": 34,
"column": 4
},
"end": {
"line": 34,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 607,
"end": 615,
"loc": {
"start": {
"line": 34,
"column": 9
},
"end": {
"line": 34,
"column": 17
},
"identifierName": "_context"
},
"name": "_context"
},
"computed": false
},
"right": {
"type": "CallExpression",
"start": 618,
"end": 650,
"loc": {
"start": {
"line": 34,
"column": 20
},
"end": {
"line": 34,
"column": 52
}
},
"callee": {
"type": "MemberExpression",
"start": 618,
"end": 648,
"loc": {
"start": {
"line": 34,
"column": 20
},
"end": {
"line": 34,
"column": 50
}
},
"object": {
"type": "Identifier",
"start": 618,
"end": 629,
"loc": {
"start": {
"line": 34,
"column": 20
},
"end": {
"line": 34,
"column": 31
},
"identifierName": "AudioSystem"
},
"name": "AudioSystem"
},
"property": {
"type": "Identifier",
"start": 630,
"end": 648,
"loc": {
"start": {
"line": 34,
"column": 32
},
"end": {
"line": 34,
"column": 50
},
"identifierName": "createAudioContext"
},
"name": "createAudioContext"
},
"computed": false
},
"arguments": []
}
}
},
{
"type": "ExpressionStatement",
"start": 657,
"end": 685,
"loc": {
"start": {
"line": 35,
"column": 4
},
"end": {
"line": 35,
"column": 32
}
},
"expression": {
"type": "AssignmentExpression",
"start": 657,
"end": 684,
"loc": {
"start": {
"line": 35,
"column": 4
},
"end": {
"line": 35,
"column": 31
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 657,
"end": 669,
"loc": {
"start": {
"line": 35,
"column": 4
},
"end": {
"line": 35,
"column": 16
}
},
"object": {
"type": "ThisExpression",
"start": 657,
"end": 661,
"loc": {
"start": {
"line": 35,
"column": 4
},
"end": {
"line": 35,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 662,
"end": 669,
"loc": {
"start": {
"line": 35,
"column": 9
},
"end": {
"line": 35,
"column": 16
},
"identifierName": "_events"
},
"name": "_events"
},
"computed": false
},
"right": {
"type": "NewExpression",
"start": 672,
"end": 684,
"loc": {
"start": {
"line": 35,
"column": 19
},
"end": {
"line": 35,
"column": 31
}
},
"callee": {
"type": "Identifier",
"start": 676,
"end": 682,
"loc": {
"start": {
"line": 35,
"column": 23
},
"end": {
"line": 35,
"column": 29
},
"identifierName": "Events"
},
"name": "Events"
},
"arguments": []
}
}
},
{
"type": "ExpressionStatement",
"start": 691,
"end": 716,
"loc": {
"start": {
"line": 36,
"column": 4
},
"end": {
"line": 36,
"column": 29
}
},
"expression": {
"type": "AssignmentExpression",
"start": 691,
"end": 715,
"loc": {
"start": {
"line": 36,
"column": 4
},
"end": {
"line": 36,
"column": 28
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 691,
"end": 703,
"loc": {
"start": {
"line": 36,
"column": 4
},
"end": {
"line": 36,
"column": 16
}
},
"object": {
"type": "ThisExpression",
"start": 691,
"end": 695,
"loc": {
"start": {
"line": 36,
"column": 4
},
"end": {
"line": 36,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 696,
"end": 703,
"loc": {
"start": {
"line": 36,
"column": 9
},
"end": {
"line": 36,
"column": 16
},
"identifierName": "_sounds"
},
"name": "_sounds"
},
"computed": false
},
"right": {
"type": "NewExpression",
"start": 706,
"end": 715,
"loc": {
"start": {
"line": 36,
"column": 19
},
"end": {
"line": 36,
"column": 28
}
},
"callee": {
"type": "Identifier",
"start": 710,
"end": 713,
"loc": {
"start": {
"line": 36,
"column": 23
},
"end": {
"line": 36,
"column": 26
},
"identifierName": "Map"
},
"name": "Map"
},
"arguments": []
}
}
},
{
"type": "ExpressionStatement",
"start": 722,
"end": 747,
"loc": {
"start": {
"line": 37,
"column": 4
},
"end": {
"line": 37,
"column": 29
}
},
"expression": {
"type": "AssignmentExpression",
"start": 722,
"end": 746,
"loc": {
"start": {
"line": 37,
"column": 4
},
"end": {
"line": 37,
"column": 28
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 722,
"end": 734,
"loc": {
"start": {
"line": 37,
"column": 4
},
"end": {
"line": 37,
"column": 16
}
},
"object": {
"type": "ThisExpression",
"start": 722,
"end": 726,
"loc": {
"start": {
"line": 37,
"column": 4
},
"end": {
"line": 37,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 727,
"end": 734,
"loc": {
"start": {
"line": 37,
"column": 9
},
"end": {
"line": 37,
"column": 16
},
"identifierName": "_musics"
},
"name": "_musics"
},
"computed": false
},
"right": {
"type": "NewExpression",
"start": 737,
"end": 746,
"loc": {
"start": {
"line": 37,
"column": 19
},
"end": {
"line": 37,
"column": 28
}
},
"callee": {
"type": "Identifier",
"start": 741,
"end": 744,
"loc": {
"start": {
"line": 37,
"column": 23
},
"end": {
"line": 37,
"column": 26
},
"identifierName": "Map"
},
"name": "Map"
},
"arguments": []
}
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * Constructor.\r\n ",
"start": 532,
"end": 561,
"loc": {
"start": {
"line": 28,
"column": 2
},
"end": {
"line": 30,
"column": 5
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * Destructor (dispose internal resources).\r\n *\r\n * @example\r\n * system.dispose();\r\n * system = null;\r\n ",
"start": 758,
"end": 881,
"loc": {
"start": {
"line": 40,
"column": 2
},
"end": {
"line": 46,
"column": 5
}
}
}
]
},
{
"type": "ClassMethod",
"start": 885,
"end": 1265,
"loc": {
"start": {
"line": 47,
"column": 2
},
"end": {
"line": 64,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 885,
"end": 892,
"loc": {
"start": {
"line": 47,
"column": 2
},
"end": {
"line": 47,
"column": 9
},
"identifierName": "dispose"
},
"name": "dispose",
"leadingComments": null
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 895,
"end": 1265,
"loc": {
"start": {
"line": 47,
"column": 12
},
"end": {
"line": 64,
"column": 3
}
},
"body": [
{
"type": "ForOfStatement",
"start": 902,
"end": 983,
"loc": {
"start": {
"line": 48,
"column": 4
},
"end": {
"line": 50,
"column": 5
}
},
"left": {
"type": "VariableDeclaration",
"start": 907,
"end": 916,
"loc": {
"start": {
"line": 48,
"column": 9