Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/improsocial/impro
An extensible Bluesky client for web impro.social
Something went wrong. Try again.
JavaScript
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768import { DataStore } from "/js/dataLayer/dataStore.js";import { createSessionState } from "/js/dataLayer/sessionState.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, constellation, ) { super(); this.api = api; this.identityResolver = identityResolver; this.draftMediaStore = draftMediaStore; this.isAuthenticated = api.isAuthenticated; this.sessionState = createSessionState( api.isAuthenticated ? api.session : null, ); this.dataStore = new DataStore(this.sessionState); this.patchStore = new PatchStore(); this.preferencesProvider = preferencesProvider; this.hiddenFeedItemsStore = hiddenFeedItemsStore; this.requests = new Requests( this.api, this.dataStore, this.preferencesProvider, this.draftMediaStore, this, constellation, ); 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 = []; }
hasCachedFeed(feedURI) { return this.dataStore.$feeds.get(feedURI) !== null; }
hasCachedAuthorFeed(profileDid, feedType) { const feedURI = `${profileDid}-${feedType}`; return this.dataStore.$authorFeeds.get(feedURI) !== null; }}