oxygen-core
Version:
Oxygen game engine (Xenon Core for browsers)
1,498 lines (1,497 loc) • 511 kB
JSON
{
"type": "File",
"start": 0,
"end": 3359,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 170,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 3359,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 170,
"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"
},
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * Permanent and session data storage.\r\n *\r\n * @example\r\n * const system = new StorageSystem({ id: 'my-game' });\r\n * system.load();\r\n * system.storage.score = (system.storage.score || 0) + 1;\r\n * system.save();\r\n ",
"start": 73,
"end": 293,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 12,
"column": 3
}
}
}
]
},
{
"type": "ExportDefaultDeclaration",
"start": 295,
"end": 3357,
"loc": {
"start": {
"line": 13,
"column": 0
},
"end": {
"line": 169,
"column": 1
}
},
"declaration": {
"type": "ClassDeclaration",
"start": 310,
"end": 3357,
"loc": {
"start": {
"line": 13,
"column": 15
},
"end": {
"line": 169,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 316,
"end": 329,
"loc": {
"start": {
"line": 13,
"column": 21
},
"end": {
"line": 13,
"column": 34
},
"identifierName": "StorageSystem"
},
"name": "StorageSystem",
"leadingComments": null
},
"superClass": {
"type": "Identifier",
"start": 338,
"end": 344,
"loc": {
"start": {
"line": 13,
"column": 43
},
"end": {
"line": 13,
"column": 49
},
"identifierName": "System"
},
"name": "System"
},
"body": {
"type": "ClassBody",
"start": 345,
"end": 3357,
"loc": {
"start": {
"line": 13,
"column": 50
},
"end": {
"line": 169,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 377,
"end": 422,
"loc": {
"start": {
"line": 16,
"column": 2
},
"end": {
"line": 18,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 381,
"end": 387,
"loc": {
"start": {
"line": 16,
"column": 6
},
"end": {
"line": 16,
"column": 12
},
"identifierName": "events"
},
"name": "events"
},
"kind": "get",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 390,
"end": 422,
"loc": {
"start": {
"line": 16,
"column": 15
},
"end": {
"line": 18,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 397,
"end": 417,
"loc": {
"start": {
"line": 17,
"column": 4
},
"end": {
"line": 17,
"column": 24
}
},
"argument": {
"type": "MemberExpression",
"start": 404,
"end": 416,
"loc": {
"start": {
"line": 17,
"column": 11
},
"end": {
"line": 17,
"column": 23
}
},
"object": {
"type": "ThisExpression",
"start": 404,
"end": 408,
"loc": {
"start": {
"line": 17,
"column": 11
},
"end": {
"line": 17,
"column": 15
}
}
},
"property": {
"type": "Identifier",
"start": 409,
"end": 416,
"loc": {
"start": {
"line": 17,
"column": 16
},
"end": {
"line": 17,
"column": 23
},
"identifierName": "_events"
},
"name": "_events"
},
"computed": false
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "* @type {Events} ",
"start": 352,
"end": 373,
"loc": {
"start": {
"line": 15,
"column": 2
},
"end": {
"line": 15,
"column": 23
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "* @type {*} ",
"start": 428,
"end": 444,
"loc": {
"start": {
"line": 20,
"column": 2
},
"end": {
"line": 20,
"column": 18
}
}
}
]
},
{
"type": "ClassMethod",
"start": 448,
"end": 495,
"loc": {
"start": {
"line": 21,
"column": 2
},
"end": {
"line": 23,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 452,
"end": 459,
"loc": {
"start": {
"line": 21,
"column": 6
},
"end": {
"line": 21,
"column": 13
},
"identifierName": "storage"
},
"name": "storage"
},
"kind": "get",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 462,
"end": 495,
"loc": {
"start": {
"line": 21,
"column": 16
},
"end": {
"line": 23,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 469,
"end": 490,
"loc": {
"start": {
"line": 22,
"column": 4
},
"end": {
"line": 22,
"column": 25
}
},
"argument": {
"type": "MemberExpression",
"start": 476,
"end": 489,
"loc": {
"start": {
"line": 22,
"column": 11
},
"end": {
"line": 22,
"column": 24
}
},
"object": {
"type": "ThisExpression",
"start": 476,
"end": 480,
"loc": {
"start": {
"line": 22,
"column": 11
},
"end": {
"line": 22,
"column": 15
}
}
},
"property": {
"type": "Identifier",
"start": 481,
"end": 489,
"loc": {
"start": {
"line": 22,
"column": 16
},
"end": {
"line": 22,
"column": 24
},
"identifierName": "_storage"
},
"name": "_storage"
},
"computed": false
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "* @type {*} ",
"start": 428,
"end": 444,
"loc": {
"start": {
"line": 20,
"column": 2
},
"end": {
"line": 20,
"column": 18
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "* @type {*} ",
"start": 501,
"end": 517,
"loc": {
"start": {
"line": 25,
"column": 2
},
"end": {
"line": 25,
"column": 18
}
}
}
]
},
{
"type": "ClassMethod",
"start": 521,
"end": 582,
"loc": {
"start": {
"line": 26,
"column": 2
},
"end": {
"line": 28,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 525,
"end": 539,
"loc": {
"start": {
"line": 26,
"column": 6
},
"end": {
"line": 26,
"column": 20
},
"identifierName": "storageSession"
},
"name": "storageSession"
},
"kind": "get",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 542,
"end": 582,
"loc": {
"start": {
"line": 26,
"column": 23
},
"end": {
"line": 28,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 549,
"end": 577,
"loc": {
"start": {
"line": 27,
"column": 4
},
"end": {
"line": 27,
"column": 32
}
},
"argument": {
"type": "MemberExpression",
"start": 556,
"end": 576,
"loc": {
"start": {
"line": 27,
"column": 11
},
"end": {
"line": 27,
"column": 31
}
},
"object": {
"type": "ThisExpression",
"start": 556,
"end": 560,
"loc": {
"start": {
"line": 27,
"column": 11
},
"end": {
"line": 27,
"column": 15
}
}
},
"property": {
"type": "Identifier",
"start": 561,
"end": 576,
"loc": {
"start": {
"line": 27,
"column": 16
},
"end": {
"line": 27,
"column": 31
},
"identifierName": "_storageSession"
},
"name": "_storageSession"
},
"computed": false
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "* @type {*} ",
"start": 501,
"end": 517,
"loc": {
"start": {
"line": 25,
"column": 2
},
"end": {
"line": 25,
"column": 18
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * Constructor.\r\n *\r\n * @param {string}\tid - application storage unique id.\r\n ",
"start": 588,
"end": 681,
"loc": {
"start": {
"line": 30,
"column": 2
},
"end": {
"line": 34,
"column": 5
}
}
}
]
},
{
"type": "ClassMethod",
"start": 685,
"end": 953,
"loc": {
"start": {
"line": 35,
"column": 2
},
"end": {
"line": 46,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 685,
"end": 696,
"loc": {
"start": {
"line": 35,
"column": 2
},
"end": {
"line": 35,
"column": 13
},
"identifierName": "constructor"
},
"name": "constructor",
"leadingComments": null
},
"kind": "constructor",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "AssignmentPattern",
"start": 697,
"end": 715,
"loc": {
"start": {
"line": 35,
"column": 14
},
"end": {
"line": 35,
"column": 32
}
},
"left": {
"type": "Identifier",
"start": 697,
"end": 699,
"loc": {
"start": {
"line": 35,
"column": 14
},
"end": {
"line": 35,
"column": 16
},
"identifierName": "id"
},
"name": "id"
},
"right": {
"type": "StringLiteral",
"start": 702,
"end": 715,
"loc": {
"start": {
"line": 35,
"column": 19
},
"end": {
"line": 35,
"column": 32
}
},
"extra": {
"rawValue": "oxygen-data",
"raw": "'oxygen-data'"
},
"value": "oxygen-data"
}
}
],
"body": {
"type": "BlockStatement",
"start": 717,
"end": 953,
"loc": {
"start": {
"line": 35,
"column": 34
},
"end": {
"line": 46,
"column": 3
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 724,
"end": 732,
"loc": {
"start": {
"line": 36,
"column": 4
},
"end": {
"line": 36,
"column": 12
}
},
"expression": {
"type": "CallExpression",
"start": 724,
"end": 731,
"loc": {
"start": {
"line": 36,
"column": 4
},
"end": {
"line": 36,
"column": 11
}
},
"callee": {
"type": "Super",
"start": 724,
"end": 729,
"loc": {
"start": {
"line": 36,
"column": 4
},
"end": {
"line": 36,
"column": 9
}
}
},
"arguments": []
}
},
{
"type": "IfStatement",
"start": 740,
"end": 831,
"loc": {
"start": {
"line": 38,
"column": 4
},
"end": {
"line": 40,
"column": 5
}
},
"test": {
"type": "BinaryExpression",
"start": 744,
"end": 766,
"loc": {
"start": {
"line": 38,
"column": 8
},
"end": {
"line": 38,
"column": 30
}
},
"left": {
"type": "UnaryExpression",
"start": 744,
"end": 753,
"loc": {
"start": {
"line": 38,
"column": 8
},
"end": {
"line": 38,
"column": 17
}
},
"operator": "typeof",
"prefix": true,
"argument": {
"type": "Identifier",
"start": 751,
"end": 753,
"loc": {
"start": {
"line": 38,
"column": 15
},
"end": {
"line": 38,
"column": 17
},
"identifierName": "id"
},
"name": "id"
},
"extra": {
"parenthesizedArgument": false
}
},
"operator": "!==",
"right": {
"type": "StringLiteral",
"start": 758,
"end": 766,
"loc": {
"start": {
"line": 38,
"column": 22
},
"end": {
"line": 38,
"column": 30
}
},
"extra": {
"rawValue": "string",
"raw": "'string'"
},
"value": "string"
}
},
"consequent": {
"type": "BlockStatement",
"start": 768,
"end": 831,
"loc": {
"start": {
"line": 38,
"column": 32
},
"end": {
"line": 40,
"column": 5
}
},
"body": [
{
"type": "ThrowStatement",
"start": 777,
"end": 824,
"loc": {
"start": {
"line": 39,
"column": 6
},
"end": {
"line": 39,
"column": 53
}
},
"argument": {
"type": "NewExpression",
"start": 783,
"end": 823,
"loc": {
"start": {
"line": 39,
"column": 12
},
"end": {
"line": 39,
"column": 52
}
},
"callee": {
"type": "Identifier",
"start": 787,
"end": 792,
"loc": {
"start": {
"line": 39,
"column": 16
},
"end": {
"line": 39,
"column": 21
},
"identifierName": "Error"
},
"name": "Error"
},
"arguments": [
{
"type": "StringLiteral",
"start": 793,
"end": 822,
"loc": {
"start": {
"line": 39,
"column": 22
},
"end": {
"line": 39,
"column": 51
}
},
"extra": {
"rawValue": "`id` is not type of String!",
"raw": "'`id` is not type of String!'"
},
"value": "`id` is not type of String!"
}
]
}
}
],
"directives": []
},
"alternate": null
},
{
"type": "ExpressionStatement",
"start": 839,
"end": 867,
"loc": {
"start": {
"line": 42,
"column": 4
},
"end": {
"line": 42,
"column": 32
}
},
"expression": {
"type": "AssignmentExpression",
"start": 839,
"end": 866,
"loc": {
"start": {
"line": 42,
"column": 4
},
"end": {
"line": 42,
"column": 31
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 839,
"end": 851,
"loc": {
"start": {
"line": 42,
"column": 4
},
"end": {
"line": 42,
"column": 16
}
},
"object": {
"type": "ThisExpression",
"start": 839,
"end": 843,
"loc": {
"start": {
"line": 42,
"column": 4
},
"end": {
"line": 42,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 844,
"end": 851,
"loc": {
"start": {
"line": 42,
"column": 9
},
"end": {
"line": 42,
"column": 16
},
"identifierName": "_events"
},
"name": "_events"
},
"computed": false
},
"right": {
"type": "NewExpression",
"start": 854,
"end": 866,
"loc": {
"start": {
"line": 42,
"column": 19
},
"end": {
"line": 42,
"column": 31
}
},
"callee": {
"type": "Identifier",
"start": 858,
"end": 864,
"loc": {
"start": {
"line": 42,
"column": 23
},
"end": {
"line": 42,
"column": 29
},
"identifierName": "Events"
},
"name": "Events"
},
"arguments": []
}
}
},
{
"type": "ExpressionStatement",
"start": 873,
"end": 887,
"loc": {
"start": {
"line": 43,
"column": 4
},
"end": {
"line": 43,
"column": 18
}
},
"expression": {
"type": "AssignmentExpression",
"start": 873,
"end": 886,
"loc": {
"start": {
"line": 43,
"column": 4
},
"end": {
"line": 43,
"column": 17
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 873,
"end": 881,
"loc": {
"start": {
"line": 43,
"column": 4
},
"end": {
"line": 43,
"column": 12
}
},
"object": {
"type": "ThisExpression",
"start": 873,
"end": 877,
"loc": {
"start": {
"line": 43,
"column": 4
},
"end": {
"line": 43,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 878,
"end": 881,
"loc": {
"start": {
"line": 43,
"column": 9
},
"end": {
"line": 43,
"column": 12
},
"identifierName": "_id"
},
"name": "_id"
},
"computed": false
},
"right": {
"type": "Identifier",
"start": 884,
"end": 886,
"loc": {
"start": {
"line": 43,
"column": 15
},
"end": {
"line": 43,
"column": 17
},
"identifierName": "id"
},
"name": "id"
}
}
},
{
"type": "ExpressionStatement",
"start": 893,
"end": 921,
"loc": {
"start": {
"line": 44,
"column": 4
},
"end": {
"line": 44,
"column": 32
}
},
"expression": {
"type": "AssignmentExpression",
"start": 893,
"end": 920,
"loc": {
"start": {
"line": 44,
"column": 4
},
"end": {
"line": 44,
"column": 31
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 893,
"end": 913,
"loc": {
"start": {
"line": 44,
"column": 4
},
"end": {
"line": 44,
"column": 24
}
},
"object": {
"type": "ThisExpression",
"start": 893,
"end": 897,
"loc": {
"start": {
"line": 44,
"column": 4
},
"end": {
"line": 44,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 898,
"end": 913,
"loc": {
"start": {
"line": 44,
"column": 9
},
"end": {
"line": 44,
"column": 24
},
"identifierName": "_storageSession"
},
"name": "_storageSession"
},
"computed": false
},
"right": {
"type": "NullLiteral",
"start": 916,
"end": 920,
"loc": {
"start": {
"line": 44,
"column": 27
},
"end": {
"line": 44,
"column": 31
}
}
}
}
},
{
"type": "ExpressionStatement",
"start": 927,
"end": 948,
"loc": {
"start": {
"line": 45,
"column": 4
},
"end": {
"line": 45,
"column": 25
}
},
"expression": {
"type": "AssignmentExpression",
"start": 927,
"end": 947,
"loc": {
"start": {
"line": 45,
"column": 4
},
"end": {
"line": 45,
"column": 24
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 927,
"end": 940,
"loc": {
"start": {
"line": 45,
"column": 4
},
"end": {
"line": 45,
"column": 17
}
},
"object": {
"type": "ThisExpression",
"start": 927,
"end": 931,
"loc": {
"start": {
"line": 45,
"column": 4
},
"end": {
"line": 45,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 932,
"end": 940,
"loc": {
"start": {
"line": 45,
"column": 9
},
"end": {
"line": 45,
"column": 17
},
"identifierName": "_storage"
},
"name": "_storage"
},
"computed": false
},
"right": {
"type": "NullLiteral",
"start": 943,
"end": 947,
"loc": {
"start": {
"line": 45,
"column": 20
},
"end": {
"line": 45,
"column": 24
}
}
}
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * Constructor.\r\n *\r\n * @param {string}\tid - application storage unique id.\r\n ",
"start": 588,
"end": 681,
"loc": {
"start": {
"line": 30,
"column": 2
},
"end": {
"line": 34,
"column": 5
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * Destructor (disposes internal resources).\r\n *\r\n * @example\r\n * system.dispose();\r\n * system = null;\r\n ",
"start": 959,
"end": 1083,
"loc": {
"start": {
"line": 48,
"column": 2
},