update
This commit is contained in:
@@ -40,13 +40,16 @@ function collectVideos(elements) {
|
||||
let pendingVideos = [];
|
||||
let sendTimer = null;
|
||||
|
||||
function queueVideos(videos) {
|
||||
async function queueVideos(videos) {
|
||||
pendingVideos.push(...videos);
|
||||
if (!sendTimer) {
|
||||
sendTimer = setTimeout(() => {
|
||||
sendTimer = setTimeout(async () => {
|
||||
if (pendingVideos.length > 0) {
|
||||
console.log(`[YT-Erfasser] ${pendingVideos.length} Videos senden`);
|
||||
browser.runtime.sendMessage(pendingVideos);
|
||||
const stored = await browser.storage.local.get("profileId");
|
||||
const profileId = stored.profileId || null;
|
||||
const batch = pendingVideos.map((v) => ({ ...v, profile_id: profileId }));
|
||||
console.log(`[YT-Erfasser] ${batch.length} Videos senden (Profil: ${profileId})`);
|
||||
browser.runtime.sendMessage(batch);
|
||||
}
|
||||
pendingVideos = [];
|
||||
sendTimer = null;
|
||||
|
||||
Reference in New Issue
Block a user