gs-events
Version:
146 lines (133 loc) • 9.33 kB
HTML
<html>
<head>
<meta charset="utf-8">
<base data-ice="baseUrl" href="../../">
<title data-ice="title">src/CustomEvent.js | gs-events</title>
<link type="text/css" rel="stylesheet" href="css/style.css">
<link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css">
<script src="script/prettify/prettify.js"></script>
<script src="script/manual.js"></script>
<meta name="description" content="事件分发器(同步)"><meta property="twitter:card" content="summary"><meta property="twitter:title" content="gs-events"><meta property="twitter:description" content="事件分发器(同步)"></head>
<body class="layout-container" data-ice="rootContainer">
<header>
<a href="./">Home</a>
<a href="identifiers.html">Reference</a>
<a href="source.html">Source</a>
<div class="search-box">
<span>
<img src="./image/search.png">
<span class="search-input-edge"></span><input class="search-input"><span class="search-input-edge"></span>
</span>
<ul class="search-result"></ul>
</div>
<a style="position:relative; top:3px;" href="https://github.com/guless/events"><img width="20px" src="./image/github.png"></a></header>
<nav class="navigation" data-ice="nav"><div>
<ul>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/CustomEvent.js~CustomEvent.html">CustomEvent</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/Event.js~Event.html">Event</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/EventDispatcher.js~EventDispatcher.html">EventDispatcher</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/EventListener.js~EventListener.html">EventListener</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/EventListenerOptions.js~EventListenerOptions.html">EventListenerOptions</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/EventPhase.js~EventPhase.html">EventPhase</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-interface">I</span><span data-ice="name"><span><a href="class/src/IEventDispatcher.js~IEventDispatcher.html">IEventDispatcher</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-interface">I</span><span data-ice="name"><span><a href="class/src/IEventListener.js~IEventListener.html">IEventListener</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-interface">I</span><span data-ice="name"><span><a href="class/src/IEventListenerOptions.js~IEventListenerOptions.html">IEventListenerOptions</a></span></span></li>
</ul>
</div>
</nav>
<div class="content" data-ice="content"><h1 data-ice="title">src/CustomEvent.js</h1>
<pre class="source-code line-number raw-source-code"><code class="prettyprint linenums" data-ice="content">/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/// @Copyright ~2018 ☜Samlv9☞ and other contributors
/// @MIT-LICENSE | 1.0.0 | https://api.guless.com/
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/// }|
/// }|
/// }|   へ    /|
/// _______ _______ ______ }| / │   / /
/// / ___ | |_ __ \ .' ____ '. }| │ Z _,< /   /`ヽ
/// | (__ \_| | |__) | | (____) | }| │     ヽ   /  〉
/// '.___`-. | __ / '_.____. | }| Y     `  /  /
/// |`\____) | _| | \ \_ | \____| | }| イ● 、 ●  ⊂⊃〈  /
/// |_______.' |____| |___| \______,' }| ()  v    | \〈
/// |=========================================\|  >ー 、_  ィ  │ //
/// |> LESS IS MORE || / へ   / ノ<|\\
/// `=========================================/| ヽ_ノ  (_/  │//
/// }| 7       |/
/// }| >―r ̄ ̄`ー―_`
/// }|
/// }|
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal
/// in the Software without restriction, including without limitation the rights
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
/// copies of the Software, and to permit persons to whom the Software is
/// furnished to do so, subject to the following conditions:
///
/// The above copyright notice and this permission notice shall be included in all
/// copies or substantial portions of the Software.
///
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
/// THE SOFTWARE.
import Event from "./Event";
/**
* 定义携带自定义数据的事件对象。
* @see {@link Event}
* @since 1.0.9
*/
export default class CustomEvent extends Event {
/**
* 创建一个支持自定义数据的事件对象。
*
* @param {String|Symbol} type - 事件类型。
* @param {any} [data=null] - 指定附加到事件对象的数据。
* @param {Boolean} [bubbles=false] - 指示该事件是否参与冒泡行为。
* @param {Boolean} [cancelable=true] - 指示该事件是否可以取消默认行为。
* @since 1.0.9
*/
constructor( type, data = null, bubbles = false, cancelable = true ) {
super(type, bubbles, cancelable);
this._data = data;
}
/**
* 重置事件状态(允许外部复用事件对象)。
*
* @param {String|Symbol} type - 事件类型。
* @param {any} [data=null] - 指定附加到事件对象的数据。
* @param {Boolean} [bubbles=false] - 指示该事件是否参与冒泡行为。
* @param {Boolean} [cancelable=true] - 指示该事件是否可以取消默认行为。
* @returns {this}
* @since 1.0.11
*/
reset( type, data = null, bubbles = false, cancelable = false ) {
super.reset(type, bubbles, cancelable);
this._data = data;
return this;
}
/**
* 获取事件对象的自定义数据。
* @type {any}
* @since 1.0.9
*/
get data() {
return this._data;
}
}</code></pre>
</div>
<footer class="footer">
Generated by <a href="https://esdoc.org">ESDoc<span data-ice="esdocVersion">(1.0.4)</span><img src="./image/esdoc-logo-mini-black.png"></a>
</footer>
<script src="script/search_index.js"></script>
<script src="script/search.js"></script>
<script src="script/pretty-print.js"></script>
<script src="script/inherited-summary.js"></script>
<script src="script/test-summary.js"></script>
<script src="script/inner-link.js"></script>
<script src="script/patch-for-local.js"></script>
</body>
</html>