Something went wrong. Try again.
Mirror of https://github.com/improsocial/improAn extensible Bluesky client for web
Something went wrong. Try again.
JavaScript
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566import { DataStore } from "/js/dataLayer/dataStore.js";import { PatchStore } from "/js/dataLayer/patchStore.js";import { Mutations } from "/js/dataLayer/mutations.js";import { Requests } from "/js/dataLayer/requests.js";import { Declarative } from "/js/dataLayer/declarative.js";import { Derived } from "/js/dataLayer/derived.js";import { EventEmitter } from "/js/eventEmitter.js";
export class DataLayer extends EventEmitter { constructor( api, preferencesProvider, identityResolver, draftMediaStore, hiddenFeedItemsStore, ) { super(); this.api = api; this.identityResolver = identityResolver; this.draftMediaStore = draftMediaStore; this.isAuthenticated = api.isAuthenticated; this.dataStore = new DataStore(); this.patchStore = new PatchStore(this.dataStore); this.preferencesProvider = preferencesProvider; this.hiddenFeedItemsStore = hiddenFeedItemsStore; this.requests = new Requests( this.api, this.dataStore, this.preferencesProvider, this.draftMediaStore, this, ); this.mutations = new Mutations( this.api, this.dataStore, this.patchStore, this.preferencesProvider, this.identityResolver, this.draftMediaStore, ); this.derived = new Derived( this.dataStore, this.patchStore, this.preferencesProvider, this.hiddenFeedItemsStore, this.isAuthenticated, this.draftMediaStore, ); this.declarative = new Declarative(this.derived, this.requests); this.subscribers = []; }
async initializePreferences() { return this.preferencesProvider.fetchPreferences(); }
hasCachedFeed(feedURI) { return this.dataStore.$feeds.get(feedURI) !== null; }
hasCachedAuthorFeed(profileDid, feedType) { const feedURI = `${profileDid}-${feedType}`; return this.dataStore.$authorFeeds.get(feedURI) !== null; }}