forked from csxiaoyaojianxian/JavaScriptStudy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path08-module.js
More file actions
45 lines (45 loc) · 1.55 KB
/
08-module.js
File metadata and controls
45 lines (45 loc) · 1.55 KB
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
var Validation;
(function (Validation) {
var lettersRegexp = /^[A-Za-z]+$/;
var numberRegexp = /^[0-9]+$/;
var LettersValidator = /** @class */ (function () {
function LettersValidator() {
}
LettersValidator.prototype.isAcceptable = function (s) {
return lettersRegexp.test(s);
};
return LettersValidator;
}());
Validation.LettersValidator = LettersValidator;
var ZipCodeValidator = /** @class */ (function () {
function ZipCodeValidator() {
}
ZipCodeValidator.prototype.isAcceptable = function (s) {
return s.length === 5 && numberRegexp.test(s);
};
return ZipCodeValidator;
}());
Validation.ZipCodeValidator = ZipCodeValidator;
})(Validation || (Validation = {}));
var Time;
(function (Time) {
var Test = /** @class */ (function () {
function Test(e) {
this.element = e;
this.element.innerHTML = "现在时间是:";
this.span = document.createElement("span");
this.element.appendChild(this.span);
this.span.innerHTML = new Date().toTimeString();
}
Test.prototype.start = function () {
var _this = this;
this.timer = setInterval(function () { return _this.span.innerHTML = new Date().toTimeString(); }, 500);
};
Test.prototype.stop = function () {
// clearTimeout(this.timer);
clearInterval(this.timer);
};
return Test;
}());
Time.Test = Test;
})(Time || (Time = {}));