This repository has been archived by the owner on Jan 4, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrequest.js.html
99 lines (72 loc) · 3.32 KB
/
request.js.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: request.js</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">Source: request.js</h1>
<section>
<article>
<pre class="prettyprint source"><code>/**
* Request is a class which is designed to be used as a property of entity to communicate with server and remember state of data transfer
* @namespace LGI.Guide
* @class Request
*/
function Request() {
//Initial request URL needed to make items observable and fire onChange event of entity
//noinspection JSUnusedGlobalSymbols
this.initialRequestURL = '';
this.nextBatchLink = '';
}
Request.prototype.execute = function (URL, callback, nextBatchSteps) {
var pipelineData = [];
//noinspection JSUnusedGlobalSymbols
this.initialRequestURL = URL;
requestTransport(URL, this.createScopedCallback(callback, nextBatchSteps, pipelineData));
};
Request.prototype.proceedResponse = function (response, nextBatchSteps, pipelineData, callback) {
pipelineData = pipelineData.concat(response.data);
if (response.nextBatchLink) {
this.nextBatchLinkURL = response.nextBatchLink.href;
} else {
this.nextBatchLinkURL = undefined;
}
if (nextBatchSteps !== undefined) {
nextBatchSteps--;
}
if ((nextBatchSteps > 0 || nextBatchSteps === undefined) && this.nextBatchLinkURL !== undefined) {
requestTransport(this.nextBatchLinkURL, this.createScopedCallback(callback, nextBatchSteps, pipelineData));
} else {
if (callback !== undefined) {
callback.bind(this)(pipelineData, response);
}
}
};
Request.prototype.createScopedCallback = function (callback, nextBatchSteps, pipelineData) {
var scopedCallback = function (data) {
this.proceedResponse(data, nextBatchSteps, pipelineData, callback);
};
return scopedCallback.bind(this);
};</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Index</a></h2><h3>Modules</h3><ul><li><a href="module-utils.html">utils</a></li></ul><h3>Classes</h3><ul><li><a href="AbstractField.html">AbstractField</a></li><li><a href="Broadcast.html">Broadcast</a></li><li><a href="Channel.html">Channel</a></li><li><a href="Collection.html">Collection</a></li><li><a href="EntityBase.html">EntityBase</a></li><li><a href="NumericField.html">NumericField</a></li><li><a href="PrependField.html">PrependField</a></li><li><a href="Region.html">Region</a></li><li><a href="Request.html">Request</a></li><li><a href="TextField.html">TextField</a></li><li><a href="Video.html">Video</a></li></ul><h3>Namespaces</h3><ul><li><a href="LGI.Guide.config.html">config</a></li></ul>
</nav>
<br clear="both">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.0-dev</a> on Mon Aug 25 2014 16:57:51 GMT+0200 (CEST)
</footer>
<script> prettyPrint(); </script>
</body>
</html>