aws-sdk-mobile-analytics
Version:
AWS Mobile Analytics SDK for JavaScript
1,274 lines (396 loc) • 19.1 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: Session</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: Session</h1>
<section>
<header>
<h2>
Session
</h2>
</header>
<article>
<div class="container-overview">
<dt>
<h4 class="name" id="Session"><span class="type-signature"></span>new Session<span class="signature">(<span class="optional">options=</span>)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>options=</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
</td>
<td class="description last">A configuration map for the Session</td>
</tr>
<tr>
<td class="name"><code>options.sessionId</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
Utilities.GUID()
</td>
<td class="description last">A sessionId for session.</td>
</tr>
<tr>
<td class="name"><code>options.appId</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
new Date().toISOString()
</td>
<td class="description last">The start Timestamp (default now).</td>
</tr>
<tr>
<td class="name"><code>options.sessionLength</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
600000
</td>
<td class="description last">Length of session in Milliseconds (default 10 minutes).</td>
</tr>
<tr>
<td class="name"><code>options.expirationCallback</code></td>
<td class="type">
<span class="param-type"><a href="AMA.Session.html#ExpirationCallback">AMA.Session.ExpirationCallback</a></span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
</td>
<td class="description last">Callback Function for when a session expires</td>
</tr>
<tr>
<td class="name"><code>options.logger=</code></td>
<td class="type">
<span class="param-type"><a href="AMA.Client.html#Logger">AMA.Client.Logger</a></span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
</td>
<td class="description last">Object containing javascript style logger functions (passing console
will output to browser dev consoles)</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="MobileAnalyticsSession.js.html">MobileAnalyticsSession.js</a>, <a href="MobileAnalyticsSession.js.html#line5">line 5</a>
</li></ul></dd>
</dl>
</dd>
</div>
<h3 class="subsection-title">Methods</h3>
<dl>
<dt>
<h4 class="name" id="clearSession"><span class="type-signature"></span>clearSession<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Clear session from storage system
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="MobileAnalyticsSession.js.html">MobileAnalyticsSession.js</a>, <a href="MobileAnalyticsSession.js.html#line86">line 86</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="expireSession"><span class="type-signature"></span>expireSession<span class="signature">(<span class="optional">Callback</span>)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Expire session and clear session
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>Callback</code></td>
<td class="type">
<span class="param-type">expirationCallback</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">function to call when sessions expire</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="MobileAnalyticsSession.js.html">MobileAnalyticsSession.js</a>, <a href="MobileAnalyticsSession.js.html#line69">line 69</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="extendSession"><span class="type-signature"></span>extendSession<span class="signature">(<span class="optional">sessionExtensionLength</span>)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Extend session by adding to the expiration timestamp
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>sessionExtensionLength</code></td>
<td class="type">
<span class="param-type">int</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
sessionLength
</td>
<td class="description last">The number of milliseconds to add to the expiration date
(session length by default).</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="MobileAnalyticsSession.js.html">MobileAnalyticsSession.js</a>, <a href="MobileAnalyticsSession.js.html#line101">line 101</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="resetSessionTimeout"><span class="type-signature"></span>resetSessionTimeout<span class="signature">(<span class="optional">milliseconds</span>)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Reset session timeout to expire in a given number of seconds
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>milliseconds</code></td>
<td class="type">
<span class="param-type">int</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
sessionLength
</td>
<td class="description last">The number of milliseconds until the session should expire (from now).</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="MobileAnalyticsSession.js.html">MobileAnalyticsSession.js</a>, <a href="MobileAnalyticsSession.js.html#line120">line 120</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="setSessionTimeout"><span class="type-signature"></span>setSessionTimeout<span class="signature">(timeout)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Setter for the session timeout
</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>timeout</code></td>
<td class="type">
<span class="param-type">int</span>
</td>
<td class="description last">epoch timestamp</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="MobileAnalyticsSession.js.html">MobileAnalyticsSession.js</a>, <a href="MobileAnalyticsSession.js.html#line131">line 131</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="stopSession"><span class="type-signature"></span>stopSession<span class="signature">(<span class="optional">stopDate</span>)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>stopDate</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
now
</td>
<td class="description last">The ISO Date String to set the stopTimestamp to (now for default).</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="MobileAnalyticsSession.js.html">MobileAnalyticsSession.js</a>, <a href="MobileAnalyticsSession.js.html#line111">line 111</a>
</li></ul></dd>
</dl>
</dd>
</dl>
<h3 class="subsection-title">Type Definitions</h3>
<dl>
<dt>
<h4 class="name" id="ExpirationCallback"><span class="type-signature"></span>ExpirationCallback<span class="signature">(session)</span><span class="type-signature"> → {boolean|int}</span></h4>
</dt>
<dd>
<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>session</code></td>
<td class="type">
<span class="param-type"><a href="AMA.Session.html">AMA.Session</a></span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="MobileAnalyticsSession.js.html">MobileAnalyticsSession.js</a>, <a href="MobileAnalyticsSession.js.html#line6">line 6</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
- Returns either true to extend the session by the sessionLength or an int with the number of
seconds to extend the session. All other values will clear the session from storage.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
|
<span class="param-type">int</span>
</dd>
</dl>
</dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Index</a></h2><h3>Modules</h3><ul><li><a href="module-AMA.html">AMA</a></li></ul><h3>Classes</h3><ul><li><a href="AMA.Client.html">Client</a></li><li><a href="AMA.Manager.html">Manager</a></li><li><a href="AMA.Session.html">Session</a></li></ul>
</nav>
<br clear="both">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Tue Jul 19 2016 13:22:17 GMT-0700 (PDT)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>