mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-28 08:22:24 +00:00
30 lines
936 B
JavaScript
30 lines
936 B
JavaScript
// js/nostr/watchHistoryBindings.js
|
|
|
|
import { nostrClient } from "./defaultClient.js";
|
|
import {
|
|
updateWatchHistoryList as updateWatchHistoryListWithManager,
|
|
removeWatchHistoryItem as removeWatchHistoryItemWithManager,
|
|
} from "./watchHistory.js";
|
|
|
|
function getWatchHistoryManager() {
|
|
return nostrClient?.watchHistory || null;
|
|
}
|
|
|
|
function assertWatchHistoryManager(operation) {
|
|
const manager = getWatchHistoryManager();
|
|
if (!manager || typeof manager[operation] !== "function") {
|
|
throw new Error("Watch history manager is unavailable in this build.");
|
|
}
|
|
return manager;
|
|
}
|
|
|
|
export function updateWatchHistoryList(...args) {
|
|
const manager = assertWatchHistoryManager("updateList");
|
|
return updateWatchHistoryListWithManager(manager, ...args);
|
|
}
|
|
|
|
export function removeWatchHistoryItem(...args) {
|
|
const manager = assertWatchHistoryManager("removeItem");
|
|
return removeWatchHistoryItemWithManager(manager, ...args);
|
|
}
|