dynatrace-api-balancer
Version:
A wrapper around Axios that balances and throttles requests across tenants, clusters and cluster nodes.
382 lines (109 loc) • 5.37 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: CancellableEventEmitter</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Class: CancellableEventEmitter</h1>
<section>
<header>
<h2><span class="attribs"><span class="type-signature"></span></span>CancellableEventEmitter<span class="signature">(request)</span><span class="type-signature"></span></h2>
<div class="class-description"><p>A cancellable event emitter at which the progress of a request
can be monitored and at which the request can be cancelled. See the NodeJS
<a href="https://nodejs.org/api/events.html#events_class_eventemitter">EventEmitter</a>
documentation for more information.</p></div>
</header>
<article>
<div class="container-overview">
<h2>Constructor</h2>
<h4 class="name" id="CancellableEventEmitter"><span class="type-signature"></span>new CancellableEventEmitter<span class="signature">(request)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Creates an instance.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>request</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>An object that should expose an 'cancel()' method
that accepts an optional reason (string).</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="lib_Cancellables.js.html">lib/Cancellables.js</a>, <a href="lib_Cancellables.js.html#line12">line 12</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Extends</h3>
<ul>
<li>EventEmitter</li>
</ul>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="cancel"><span class="type-signature"></span>cancel<span class="signature">(reason)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Cancel the request. If a reason is provided, it will cause the
<a href="global.html#RequestCallback"><code>RequestCallback</code></a> provided to the <a href="BalancedAPIRequest.html#fetch"><code>fetch()</code></a> method
to be called with a <a href="global.html#RequestError"><code>RequestError</code></a> as it single argument, containing
status 512 and this reason as its message.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>reason</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>The reason for the cancellation. If omitted, the request will be cancelled or aborted silently.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="lib_Cancellables.js.html">lib/Cancellables.js</a>, <a href="lib_Cancellables.js.html#line32">line 32</a>
</li></ul></dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="BalancedAPIRequest.html">BalancedAPIRequest</a></li><li><a href="CancellableEventEmitter.html">CancellableEventEmitter</a></li><li><a href="CancellablePromise.html">CancellablePromise</a></li><li><a href="DirectAPIRequest.html">DirectAPIRequest</a></li><li><a href="Throttle.html">Throttle</a></li></ul><h3><a href="global.html">Global</a></h3>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> on Sun Dec 19 2021 10:28:40 GMT-0600 (Central Standard Time)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>