forked from iann0036/cloud9-sync
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuserManager.js
34 lines (34 loc) · 1.19 KB
/
userManager.js
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
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var UserManager = /** @class */ (function () {
function UserManager() {
this.clients = {};
this.ignoredclients = [];
}
UserManager.prototype.setPosition = function (clientId, fileName, document, range, isReversed) {
var documentUri = document.uri.toString();
var startOffset = document.offsetAt(range.start);
var endOffset = document.offsetAt(range.end);
this.clients[clientId] = {
fileName: fileName,
documentUri: documentUri,
range: range,
isReversed: isReversed,
startOffset: startOffset,
endOffset: endOffset
};
};
UserManager.prototype.getPosition = function (clientId) {
if (this.ignoredclients.includes(clientId))
return null;
return this.clients[clientId];
};
UserManager.prototype.removeClient = function (clientId) {
delete this.clients[clientId];
};
UserManager.prototype.addIgnoredClient = function (clientid) {
this.ignoredclients.push(clientid);
};
return UserManager;
}());
exports.UserManager = UserManager;