UNPKG

gs-events

Version:

事件分发器(同步)

1,677 lines (1,676 loc) 187 kB
{ "type": "File", "start": 0, "end": 3945, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 100, "column": 1 } }, "program": { "type": "Program", "start": 0, "end": 3945, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 100, "column": 1 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 2394, "end": 2440, "loc": { "start": { "line": 38, "column": 0 }, "end": { "line": 38, "column": 46 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 2401, "end": 2415, "loc": { "start": { "line": 38, "column": 7 }, "end": { "line": 38, "column": 21 } }, "local": { "type": "Identifier", "start": 2401, "end": 2415, "loc": { "start": { "line": 38, "column": 7 }, "end": { "line": 38, "column": 21 }, "identifierName": "IEventListener" }, "name": "IEventListener", "leadingComments": null }, "leadingComments": null } ], "source": { "type": "StringLiteral", "start": 2421, "end": 2439, "loc": { "start": { "line": 38, "column": 27 }, "end": { "line": 38, "column": 45 } }, "extra": { "rawValue": "./IEventListener", "raw": "\"./IEventListener\"" }, "value": "./IEventListener" }, "leadingComments": [ { "type": "CommentLine", "value": "/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~", "start": 0, "end": 78, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 78 } } }, { "type": "CommentLine", "value": "/ @Copyright ~2018 ☜Samlv9☞ and other contributors", "start": 79, "end": 131, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 52 } } }, { "type": "CommentLine", "value": "/ @MIT-LICENSE | 1.0.0 | https://api.guless.com/", "start": 132, "end": 182, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 3, "column": 50 } } }, { "type": "CommentLine", "value": "/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~", "start": 183, "end": 261, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 4, "column": 78 } } }, { "type": "CommentLine", "value": "/ }|", "start": 262, "end": 313, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 5, "column": 51 } } }, { "type": "CommentLine", "value": "/ }|", "start": 314, "end": 365, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 6, "column": 51 } } }, { "type": "CommentLine", "value": "/ }|   へ    /| ", "start": 366, "end": 435, "loc": { "start": { "line": 7, "column": 0 }, "end": { "line": 7, "column": 69 } } }, { "type": "CommentLine", "value": "/ _______ _______ ______ }| / │   / /", "start": 436, "end": 502, "loc": { "start": { "line": 8, "column": 0 }, "end": { "line": 8, "column": 66 } } }, { "type": "CommentLine", "value": "/ / ___ | |_ __ \\ .' ____ '. }| │ Z _,< /   /`ヽ", "start": 503, "end": 574, "loc": { "start": { "line": 9, "column": 0 }, "end": { "line": 9, "column": 71 } } }, { "type": "CommentLine", "value": "/ | (__ \\_| | |__) | | (____) | }| │     ヽ   /  〉", "start": 575, "end": 645, "loc": { "start": { "line": 10, "column": 0 }, "end": { "line": 10, "column": 70 } } }, { "type": "CommentLine", "value": "/ '.___`-. | __ / '_.____. | }| Y     `  /  /", "start": 646, "end": 716, "loc": { "start": { "line": 11, "column": 0 }, "end": { "line": 11, "column": 70 } } }, { "type": "CommentLine", "value": "/ |`\\____) | _| | \\ \\_ | \\____| | }| イ● 、 ●  ⊂⊃〈  /", "start": 717, "end": 786, "loc": { "start": { "line": 12, "column": 0 }, "end": { "line": 12, "column": 69 } } }, { "type": "CommentLine", "value": "/ |_______.' |____| |___| \\______,' }| ()  v    | \〈", "start": 787, "end": 855, "loc": { "start": { "line": 13, "column": 0 }, "end": { "line": 13, "column": 68 } } }, { "type": "CommentLine", "value": "/ |=========================================\\|  >ー 、_  ィ  │ //", "start": 856, "end": 926, "loc": { "start": { "line": 14, "column": 0 }, "end": { "line": 14, "column": 70 } } }, { "type": "CommentLine", "value": "/ |> LESS IS MORE || / へ   / ノ<|\\", "start": 927, "end": 996, "loc": { "start": { "line": 15, "column": 0 }, "end": { "line": 15, "column": 69 } } }, { "type": "CommentLine", "value": "/ `=========================================/| ヽ_ノ  (_/  │//", "start": 997, "end": 1065, "loc": { "start": { "line": 16, "column": 0 }, "end": { "line": 16, "column": 68 } } }, { "type": "CommentLine", "value": "/ }| 7       |/", "start": 1066, "end": 1133, "loc": { "start": { "line": 17, "column": 0 }, "end": { "line": 17, "column": 67 } } }, { "type": "CommentLine", "value": "/ }| >―r ̄ ̄`ー―_`", "start": 1134, "end": 1200, "loc": { "start": { "line": 18, "column": 0 }, "end": { "line": 18, "column": 66 } } }, { "type": "CommentLine", "value": "/ }|", "start": 1201, "end": 1252, "loc": { "start": { "line": 19, "column": 0 }, "end": { "line": 19, "column": 51 } } }, { "type": "CommentLine", "value": "/ }|", "start": 1253, "end": 1304, "loc": { "start": { "line": 20, "column": 0 }, "end": { "line": 20, "column": 51 } } }, { "type": "CommentLine", "value": "/ Permission is hereby granted, free of charge, to any person obtaining a copy", "start": 1305, "end": 1385, "loc": { "start": { "line": 21, "column": 0 }, "end": { "line": 21, "column": 80 } } }, { "type": "CommentLine", "value": "/ of this software and associated documentation files (the \"Software\"), to deal", "start": 1386, "end": 1467, "loc": { "start": { "line": 22, "column": 0 }, "end": { "line": 22, "column": 81 } } }, { "type": "CommentLine", "value": "/ in the Software without restriction, including without limitation the rights", "start": 1468, "end": 1548, "loc": { "start": { "line": 23, "column": 0 }, "end": { "line": 23, "column": 80 } } }, { "type": "CommentLine", "value": "/ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell", "start": 1549, "end": 1626, "loc": { "start": { "line": 24, "column": 0 }, "end": { "line": 24, "column": 77 } } }, { "type": "CommentLine", "value": "/ copies of the Software, and to permit persons to whom the Software is", "start": 1627, "end": 1700, "loc": { "start": { "line": 25, "column": 0 }, "end": { "line": 25, "column": 73 } } }, { "type": "CommentLine", "value": "/ furnished to do so, subject to the following conditions:", "start": 1701, "end": 1761, "loc": { "start": { "line": 26, "column": 0 }, "end": { "line": 26, "column": 60 } } }, { "type": "CommentLine", "value": "/", "start": 1762, "end": 1765, "loc": { "start": { "line": 27, "column": 0 }, "end": { "line": 27, "column": 3 } } }, { "type": "CommentLine", "value": "/ The above copyright notice and this permission notice shall be included in all", "start": 1766, "end": 1848, "loc": { "start": { "line": 28, "column": 0 }, "end": { "line": 28, "column": 82 } } }, { "type": "CommentLine", "value": "/ copies or substantial portions of the Software.", "start": 1849, "end": 1900, "loc": { "start": { "line": 29, "column": 0 }, "end": { "line": 29, "column": 51 } } }, { "type": "CommentLine", "value": "/", "start": 1901, "end": 1904, "loc": { "start": { "line": 30, "column": 0 }, "end": { "line": 30, "column": 3 } } }, { "type": "CommentLine", "value": "/ THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR", "start": 1905, "end": 1983, "loc": { "start": { "line": 31, "column": 0 }, "end": { "line": 31, "column": 78 } } }, { "type": "CommentLine", "value": "/ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,", "start": 1984, "end": 2060, "loc": { "start": { "line": 32, "column": 0 }, "end": { "line": 32, "column": 76 } } }, { "type": "CommentLine", "value": "/ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE", "start": 2061, "end": 2140, "loc": { "start": { "line": 33, "column": 0 }, "end": { "line": 33, "column": 79 } } }, { "type": "CommentLine", "value": "/ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER", "start": 2141, "end": 2215, "loc": { "start": { "line": 34, "column": 0 }, "end": { "line": 34, "column": 74 } } }, { "type": "CommentLine", "value": "/ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,", "start": 2216, "end": 2297, "loc": { "start": { "line": 35, "column": 0 }, "end": { "line": 35, "column": 81 } } }, { "type": "CommentLine", "value": "/ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN", "start": 2298, "end": 2375, "loc": { "start": { "line": 36, "column": 0 }, "end": { "line": 36, "column": 77 } } }, { "type": "CommentLine", "value": "/ THE SOFTWARE.", "start": 2376, "end": 2393, "loc": { "start": { "line": 37, "column": 0 }, "end": { "line": 37, "column": 17 } } } ] }, { "type": "ImportDeclaration", "start": 2441, "end": 2501, "loc": { "start": { "line": 39, "column": 0 }, "end": { "line": 39, "column": 60 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 2448, "end": 2469, "loc": { "start": { "line": 39, "column": 7 }, "end": { "line": 39, "column": 28 } }, "local": { "type": "Identifier", "start": 2448, "end": 2469, "loc": { "start": { "line": 39, "column": 7 }, "end": { "line": 39, "column": 28 }, "identifierName": "IEventListenerOptions" }, "name": "IEventListenerOptions" } } ], "source": { "type": "StringLiteral", "start": 2475, "end": 2500, "loc": { "start": { "line": 39, "column": 34 }, "end": { "line": 39, "column": 59 } }, "extra": { "rawValue": "./IEventListenerOptions", "raw": "\"./IEventListenerOptions\"" }, "value": "./IEventListenerOptions" } }, { "type": "ImportDeclaration", "start": 2502, "end": 2530, "loc": { "start": { "line": 40, "column": 0 }, "end": { "line": 40, "column": 28 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 2509, "end": 2514, "loc": { "start": { "line": 40, "column": 7 }, "end": { "line": 40, "column": 12 } }, "local": { "type": "Identifier", "start": 2509, "end": 2514, "loc": { "start": { "line": 40, "column": 7 }, "end": { "line": 40, "column": 12 }, "identifierName": "Event" }, "name": "Event" } } ], "source": { "type": "StringLiteral", "start": 2520, "end": 2529, "loc": { "start": { "line": 40, "column": 18 }, "end": { "line": 40, "column": 27 } }, "extra": { "rawValue": "./Event", "raw": "\"./Event\"" }, "value": "./Event" } }, { "type": "ImportDeclaration", "start": 2531, "end": 2589, "loc": { "start": { "line": 41, "column": 0 }, "end": { "line": 41, "column": 58 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 2538, "end": 2558, "loc": { "start": { "line": 41, "column": 7 }, "end": { "line": 41, "column": 27 } }, "local": { "type": "Identifier", "start": 2538, "end": 2558, "loc": { "start": { "line": 41, "column": 7 }, "end": { "line": 41, "column": 27 }, "identifierName": "EventListenerOptions" }, "name": "EventListenerOptions" } } ], "source": { "type": "StringLiteral", "start": 2564, "end": 2588, "loc": { "start": { "line": 41, "column": 33 }, "end": { "line": 41, "column": 57 } }, "extra": { "rawValue": "./EventListenerOptions", "raw": "\"./EventListenerOptions\"" }, "value": "./EventListenerOptions" }, "trailingComments": [ { "type": "CommentBlock", "value": "*\n * 定义 {@link EventDispatcher} 的事件侦听器对象。\n * @implements {IEventListener}\n * @since 1.0.0\n ", "start": 2591, "end": 2686, "loc": { "start": { "line": 43, "column": 0 }, "end": { "line": 47, "column": 3 } } } ] }, { "type": "ExportDefaultDeclaration", "start": 2687, "end": 3945, "loc": { "start": { "line": 48, "column": 0 }, "end": { "line": 100, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 2702, "end": 3945, "loc": { "start": { "line": 48, "column": 15 }, "end": { "line": 100, "column": 1 } }, "id": { "type": "Identifier", "start": 2708, "end": 2721, "loc": { "start": { "line": 48, "column": 21 }, "end": { "line": 48, "column": 34 }, "identifierName": "EventListener" }, "name": "EventListener", "leadingComments": null, "trailingComments": [ { "type": "CommentBlock", "value": "< implement IEventListener >", "start": 2722, "end": 2754, "loc": { "start": { "line": 48, "column": 35 }, "end": { "line": 48, "column": 67 } } } ] }, "superClass": null, "body": { "type": "ClassBody", "start": 2755, "end": 3945, "loc": { "start": { "line": 48, "column": 68 }, "end": { "line": 100, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 2967, "end": 3265, "loc": { "start": { "line": 56, "column": 4 }, "end": { "line": 66, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 2967, "end": 2978, "loc": { "start": { "line": 56, "column": 4 }, "end": { "line": 56, "column": 15 }, "identifierName": "constructor" }, "name": "constructor", "leadingComments": null }, "kind": "constructor", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 2980, "end": 2987, "loc": { "start": { "line": 56, "column": 17 }, "end": { "line": 56, "column": 24 }, "identifierName": "handler" }, "name": "handler" }, { "type": "AssignmentPattern", "start": 2989, "end": 3004, "loc": { "start": { "line": 56, "column": 26 }, "end": { "line": 56, "column": 41 } }, "left": { "type": "Identifier", "start": 2989, "end": 2996, "loc": { "start": { "line": 56, "column": 26 }, "end": { "line": 56, "column": 33 }, "identifierName": "options" }, "name": "options" }, "right": { "type": "BooleanLiteral", "start": 2999, "end": 3004, "loc": { "start": { "line": 56, "column": 36 }, "end": { "line": 56, "column": 41 } }, "value": false } } ], "body": { "type": "BlockStatement", "start": 3007, "end": 3265, "loc": { "start": { "line": 56, "column": 44 }, "end": { "line": 66, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 3084, "end": 3108, "loc": { "start": { "line": 60, "column": 8 }, "end": { "line": 60, "column": 32 } }, "expression": { "type": "AssignmentExpression", "start": 3084, "end": 3107, "loc": { "start": { "line": 60, "column": 8 }, "end": { "line": 60, "column": 31 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 3084, "end": 3097, "loc": { "start": { "line": 60, "column": 8 }, "end": { "line": 60, "column": 21 } }, "object": { "type": "ThisExpression", "start": 3084, "end": 3088, "loc": { "start": { "line": 60, "column": 8 }, "end": { "line": 60, "column": 12 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 3089, "end": 3097, "loc": { "start": { "line": 60, "column": 13 }, "end": { "line": 60, "column": 21 }, "identifierName": "_handler" }, "name": "_handler" }, "computed": false, "leadingComments": null }, "right": { "type": "Identifier", "start": 3100, "end": 3107, "loc": { "start": { "line": 60, "column": 24 }, "end": { "line": 60, "column": 31 }, "identifierName": "handler" }, "name": "handler" }, "leadingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @type {Function|IEventListener}\n ", "start": 3017, "end": 3075, "loc": { "start": { "line": 57, "column": 8 }, "end": { "line": 59, "column": 11 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * @type {EventListenerOptions}\n ", "start": 3126, "end": 3181, "loc": { "start": { "line": 62, "column": 8 }, "end": { "line": 64, "column": 11 } } } ] }, { "type": "ExpressionStatement", "start": 3190, "end": 3259, "loc": { "start": { "line": 65, "column": 8 }, "end": { "line": 65, "column": 77 } }, "expression": { "type": "AssignmentExpression", "start": 3190, "end": 3258, "loc": { "start": { "line": 65, "column": 8 }, "end": { "line": 65, "column": 76 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 3190, "end": 3203, "loc": { "start": { "line": 65, "column": 8 }, "end": { "line": 65, "column": 21 } }, "object": { "type": "ThisExpression", "start": 3190, "end": 3194, "loc": { "start": { "line": 65, "column": 8 }, "end": { "line": 65, "column": 12 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 3195, "end": 3203, "loc": { "start": { "line": 65, "column": 13 }, "end": { "line": 65, "column": 21 }, "identifierName": "_options" }, "name": "_options" }, "computed": false, "leadingComments": null }, "right": { "type": "CallExpression", "start": 3206, "end": 3258, "loc": { "start": { "line": 65, "column": 24 }, "end": { "line": 65, "column": 76 } }, "callee": { "type": "MemberExpression", "start": 3206, "end": 3249, "loc": { "start": { "line": 65, "column": 24 }, "end": { "line": 65, "column": 67 } }, "object": { "type": "NewExpression", "start": 3207, "end": 3233, "loc": { "start": { "line": 65, "column": 25 }, "end": { "line": 65, "column": 51 } }, "callee": { "type": "Identifier", "start": 3211, "end": 3231, "loc": { "start": { "line": 65, "column": 29 }, "end": { "line": 65, "column": 49 }, "identifierName": "EventListenerOptions" }, "name": "EventListenerOptions" }, "arguments": [], "extra": { "parenthesized": true, "parenStart": 3206 } }, "property": { "type": "Identifier", "start": 3235, "end": 3249, "loc": { "start": { "line": 65, "column": 53 }, "end": { "line": 65, "column": 67 }, "identifierName": "initWithParams" }, "name": "initWithParams" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 3250, "end": 3257, "loc": { "start": { "line": 65, "column": 68 }, "end": { "line": 65, "column": 75 }, "identifierName": "options" }, "name": "options" } ] }, "leadingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @type {EventListenerOptions}\n ", "start": 3126, "end": 3181, "loc": { "start": { "line": 62, "column": 8 }, "end": { "line": 64, "column": 11 } } } ] } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * 创建一个侦听器对象。\n * \n * @param {Function|IEventListener} handler - 指定事件处理函数或者是一个侦听器。\n * @param {Boolean|IEventListenerOptions} [options=false] - 指定侦听器的配置选项。\n * @since 1.0.0\n ", "start": 2761, "end": 2962, "loc": { "start": { "line": 49, "column": 4 }, "end": { "line": 55, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * 获取侦听器的处理函数。\n * @type {Function|IEventListener}\n * @since 1.0.0\n ", "start": 3275, "end": 3364, "loc": { "start": { "line": 68, "column": 4 }, "end": { "line": 72, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 3369, "end": 3420, "loc": { "start": { "line": 73, "column": 4 }, "end": { "line": 75, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 3373, "end": 3380, "loc": { "start": { "line": 73, "column": 8 }, "end": { "line": 73, "column": 15 }, "identifierName": "handler" }, "name": "handler" }, "kind": "get", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 3383, "end": 3420, "loc": { "start": { "line": 73, "column": 18 }, "end": { "line": 75, "column": 5 } }, "body": [ { "type": "ReturnStatement", "start": 3393, "end": 3414, "loc": { "start": { "line": 74, "column": 8 }, "end": { "line": 74, "column": 29 } }, "argument": { "type": "MemberExpression", "start": 3400, "end": 3413, "loc": { "start": { "line": 74, "column": 15 }, "end": { "line": 74, "column": 28 } }, "object": { "type": "ThisExpression", "start": 3400, "end": 3404, "loc": { "start": { "line": 74, "column": 15 }, "end": { "line": 74, "column": 19 } } }, "property": { "type": "Identifier", "start": 3405, "end": 3413, "loc": { "start": { "line": 74, "column": 20 }, "end": { "line": 74, "column": 28 }, "identifierName": "_handler" }, "name": "_handler" }, "computed": false } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * 获取侦听器的处理函数。\n * @type {Function|IEventListener}\n * @since 1.0.0\n ", "start": 3275, "end": 3364, "loc": { "start": { "line": 68, "column": 4 }, "end": { "line": 72, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * 获取侦听器的配置选项。\n * @type {EventListenerOptions}\n * @since 1.0.0\n ", "start": 3430, "end": 3516, "loc": { "start": { "line": 77, "column": 4 }, "end": { "line": 81, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 3521, "end": 3572, "loc": { "start": { "line": 82, "column": 4 }, "end": { "line": 84, "column": 5 } }, "static": false, "computed": false, "key": {