-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings.js
More file actions
63 lines (50 loc) · 1.54 KB
/
settings.js
File metadata and controls
63 lines (50 loc) · 1.54 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
function appSetting () {
this.timeOut = 60
this.warningTime = 1500
this.sendAlert = false
this.userName = 'user'
this.password = 'pass'
this.errorForSend = 3
this.minErrorTimeout=5000
this.useDataBase = false
this.emails = [ {name: 'admin@root.ru'} ]
}
appSetting.prototype.getData = function ()
{
var self = this
var data = {
timeOut: self.timeOut,
warningTime: self.warningTime,
sendAlert: self.sendAlert,
userName: self.userName,
password: self.password,
errorForSend: self.errorForSend,
minErrorTimeout: self.minErrorTimeout,
emails: self.emails
}
return data
}
appSetting.prototype.update = function (data)
{
var updateData = JSON.parse(JSON.stringify(data))
var self = this
self.timeOut=updateData.timeOut
self.warningTime = updateData.warningTime
self.sendAlert = updateData.sendAlert
self.userName = updateData.userName
self.password = updateData.password
self.errorForSend = updateData.errorForSend
// self.minErrorTimeout = updateData.minErrorTimeout
self.emails=[]
updateData.emails.forEach(function (email) {
self.emails.push({name: email.name})
})
}
appSetting.instance = null;
appSetting.getInstance = function(){
if(this.instance === null){
this.instance = new appSetting();
}
return this.instance;
}
module.exports = appSetting.getInstance();