Skip to content

Commit

Permalink
final timer
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-murray committed Sep 5, 2024
1 parent 6a890b8 commit ebd2196
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 20 deletions.
17 changes: 17 additions & 0 deletions dist/assets/index-B3BgoitO.js

Large diffs are not rendered by default.

17 changes: 0 additions & 17 deletions dist/assets/index-BHqCPBtS.js

This file was deleted.

2 changes: 1 addition & 1 deletion dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Split Feed for Twitch by Deleter</title>
<script type="module" crossorigin src="/split-feed/assets/index-BHqCPBtS.js"></script>
<script type="module" crossorigin src="/split-feed/assets/index-B3BgoitO.js"></script>
<link rel="stylesheet" crossorigin href="/split-feed/assets/index-DE9AxhnM.css">
</head>
<body>
Expand Down
16 changes: 14 additions & 2 deletions src/components/NotificationFeed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ onMounted(() => {
async function addNotification(notification) {
notification.time = new Date();
notification.time_since = 0;
await notifications.value.push(notification);
Expand Down Expand Up @@ -100,6 +101,13 @@ setInterval(() => {
});
}, 30000);
// loop notifications every 1 minute to updated time since
setInterval(() => {
for (let notification of notifications.value) {
notification.time_since++;
}
}, 1000);
// connect to twitch via websockets wss://eventsub.wss.twitch.tv/ws
let ws = [];
let i = 0;
Expand Down Expand Up @@ -518,15 +526,19 @@ if (debug) {
}
}];
let j = 0;
setInterval(() => {
for (let message of messages) {
// random chance to process message
if (Math.random() > 0.25) {
//if (Math.random() > 0.25) {
if (j > 1) {
continue;
}
j++;
switch (message.metadata.message_type) {
case 'session_welcome':
if (i == 0) {
Expand Down Expand Up @@ -681,7 +693,7 @@ if (debug) {
<div v-if="notification.user_total" class="notify-pill">{{ notification.user_total }} total
</div>
<!-- show time since notification in minutes -->
<div class="notify-time">{{ Math.floor((new Date() - new Date(notification.time)) / 60000) }} mins</div>
<div class="notify-time">{{ notification.time_since < 60 ? notification.time_since + ' secs' : Math.floor(notification.time_since / 60) + ' mins' }}</div>
</div>
<div class="font-bold text-xl mt-1">{{ notification.raider || notification.user }}</div>
<div class="text-lg">{{ notification.text || (notification.type == "sub_gift" ? "Gifted to " +
Expand Down

0 comments on commit ebd2196

Please sign in to comment.