Git Repository Public Repository

namibia

URLs

Copy to Clipboard
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
APE.Request.CycledStack = new Class({
	initialize: function(ape) {
		this.ape = ape;

		this.stack = [];
		this.reajustTime = false;

		this.timer = this.send.periodical(this.ape.options.cycledStackTime, this);
	},

	add: function(cmd, params, sessid) {
		this.stack.push({'cmd':cmd, 'params':params, 'sessid':sessid});
	},

	setTime: function(time, now) {
		if (now) {
			this.send();
			$clear(this.timer);
			this.timer = this.send.periodical(time, this);
			this.reajustTime = false;
		}
		else this.reajustTime = time;
	},

	send: function() {
		if (this.stack.length > 0) {
			this.ape.request.send(this.stack);
			this.stack = [];
			if (this.reajustTime) {
				this.setTime(this.reajustTime, true);
			}
		}
	}
});

Commits for namibia/public/ape-source/Request/Request.CycledStack.js

Diff revisions: vs.
Revision Author Commited Message
df0489 ... Mark Fri 14 Oct, 2016 10:01:00 +0000

initial commit