/
BCL.js
57 lines (47 loc) · 997 Bytes
/
BCL.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// C#'ish patterns - Common BCL functionality
function Tuple(first, second, third) {
this.first = first;
this.second = second;
if (arguments.length == 3) {
this.third = third;
}
}
function StringBuilder(s) {
this._parts = isValue(s) && s !== '' ? [s] : [];
this.isEmpty = this._parts.length == 0;
}
var StringBuilder$proto = {
append: function(s) {
if (isValue(s) && s !== '') {
this._parts.push(s);
this.isEmpty = false;
}
return this;
},
appendLine: function(s) {
this.append(s);
this._parts.push('\r\n');
this.isEmpty = false;
return this;
},
clear: function() {
this._parts = [];
this.isEmpty = true;
},
toString: function(s) {
return this._parts.join(s || '');
}
};
function EventArgs() {
}
function CancelEventArgs() {
this.cancel = false;
}
function IDisposable() { }
// dispose()
function IEnumerable() { }
// getEnumerator()
function IEnumerator() { }
// get_current
// moveNext()
// reset()