-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
40 lines (35 loc) · 872 Bytes
/
index.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
var hookhubDoc = function (docType, docTopic) {
let newDoc = {
type: docType,
topic: docTopic,
source: {
name: '',
link: '',
img: ''
},
messages: [],
options: {},
setType: function (docType) {
this.type = docType
},
setTopic: function (docTopic) {
this.topic = docTopic
},
setAuthor: function (docSourceName, docSourceLink, docSourceImg) {
this.source.name = docSourceName
if (docSourceLink !== null) this.source.link = docSourceLink
if (docSourceImg !== null) this.source.Img = docSourceImg
},
addMessage: function (id, message, timestamp, url, options) {
this.messages.push = {
id: id,
message: message,
timestamp: timestamp,
url: url,
options: options
}
}
}
return newDoc
}
module.exports = hookhubDoc