updated to use new TwitchCollector
This commit is contained in:
parent
11f3cbfa7b
commit
f77a516729
|
@ -1,20 +1,18 @@
|
||||||
function showData(data) {
|
function showData(data) {
|
||||||
if (typeof data === "undefined" || data === null) {
|
if (!data) {
|
||||||
console.error("Data is empty");
|
console.error("Data is empty");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof data.Followers === "undefined" || data.Followers === null) {
|
if (!data.Followers) {
|
||||||
console.error("No followers data found");
|
console.error("No followers data found");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let followers = document.getElementById("followers");
|
const followers = document.getElementById("followers");
|
||||||
followers.innerHTML = data.Followers.total;
|
followers.innerHTML = data.Followers.total;
|
||||||
}
|
}
|
||||||
|
|
||||||
let collector = Object.create(twitchCollector);
|
const collector = new TwitchCollector();
|
||||||
collector.registerHook("update", function(data) {
|
collector.registerHook("update", showData);
|
||||||
showData(data);
|
collector.start();
|
||||||
});
|
|
||||||
collector.start();
|
|
||||||
|
|
Reference in New Issue
Block a user