-
Notifications
You must be signed in to change notification settings - Fork 2
/
ttObjects.js
51 lines (46 loc) · 1.25 KB
/
ttObjects.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
(function() {
var ttObjects = {
room : null,
getRoom : function() {
for (var memberName in turntable) {
var member = turntable[memberName];
if (typeof member !== 'object' || member === null) continue;
if (typeof member.setupRoom !== 'undefined') {
ttObjects.room = member;
return member;
}
}
return false;
},
manager : null,
getManager : function() {
for (var memberName in ttObjects.getRoom()) {
var member = ttObjects.room[memberName];
if (typeof member !== 'object' || member === null) continue;
if (typeof member.callback !== 'undefined') {
ttObjects.manager = member;
return member;
}
}
return false;
},
api : null,
getApi: function () {
var apiRegex = / Preparing message /i;
for (var memberName in turntable) {
var member = turntable[memberName];
if (typeof member !== 'function') continue;
if (apiRegex.test(Function.prototype.toString.apply(member))) {
ttObjects.api = member;
return member;
}
}
return false;
}
};
// export our object
if (typeof module === 'object' && exports in module)
module.exports = ttObjects;
if (typeof window !== "undefined")
window.ttObjects = ttObjects;
})();