Options
All
  • Public
  • Public/Protected
  • All
Menu

Class State<T>

State handler for services.

Type parameters

Hierarchy

Implements

Index

Constructors

constructor

  • new State(serviceID: string): State

Properties

Protected internalMemory

internalMemory: Namespace

memory

Optional page

page: ServicePage<T>

serviceId

serviceId: string

Accessors

config

  • get config(): Promise<Config>

Methods

Protected assignMemory

buildIdentifier

  • buildIdentifier(mediaID: string): Promise<string>
  • Build an identifier for the given MediaID.

    see

    [[STATIC_STORE.buildIdentifier]]

    Parameters

    • mediaID: string

    Returns Promise<string>

forget

  • forget(key: string, forgetNamespace?: undefined | false | true): void
  • Delete the value of the provided namespace key.

    Parameters

    • key: string
    • Optional forgetNamespace: undefined | false | true

      if true this operation behaves like Memory.resetMemory with the key as an argument. Otherwise it merely removes the specified namespace.

    Returns void

getStoredAnimeInfo

  • Get the stored StoredAnimeInfo for the provided identifier. The returned value is a StorageObject and thus can be used to alter the stored version directly.

    Even if nothing is stored, this method still returns an instance of StoredAnimeInfo which you may use to write to.

    Parameters

    • animeID: string

    Returns Promise<StoredAnimeInfo>

getSubscribed$

  • getSubscribed$(animeID: string): Promise<Observable<boolean>>
  • Get an observable which keeps track of whether the user is subscribed to the Anime It immediately pushes the current state to the observer.

    Parameters

    • animeID: string

    Returns Promise<Observable<boolean>>

getSubscription

injected

  • injected(el: Node, ns?: undefined | string): void

loadPage

reload

  • reload(): Promise<void>
  • Reset state and reload current service page.

    Returns Promise<void>

remember

  • remember(key: string, value: any): void
  • Store the given value under the namespace key.

    Parameters

    • key: string

      Namespaces are separated by a dot

    • value: any

    Returns void

removeInjected

  • removeInjected(...namespaces: string[]): void
  • Remove all elements from the given namespaces. Removing elements of a namespace also removes all elements in namespaces further down.

    If no namespaces provided removes all elements.

    Parameters

    • Rest ...namespaces: string[]

    Returns void

renderWithTheme

  • renderWithTheme(element: React.ReactNode, tag?: keyof HTMLElementTagNameMap | Element): Element
  • Parameters

    • element: React.ReactNode
    • Default value tag: keyof HTMLElementTagNameMap | Element = "div"

    Returns Element

resetMemory

  • resetMemory(...namespaces: string[]): void
  • Reset the given namespaces and all their children.

    When called with no arguments this flushes the entire memory (i.e. deletes all keys).

    see

    Memory.forget to remove a specific namespace without affecting its children.

    Parameters

    • Rest ...namespaces: string[]

    Returns void

resetState

  • resetState(): void

subscribeAnime

  • subscribeAnime(animeID: string, animeURL: string, nextEpisodeURL: string | undefined, episodesWatched: number, anime: AnimeInfo): Promise<void>
  • Subscribe to an Anime

    Parameters

    • animeID: string
    • animeURL: string
    • nextEpisodeURL: string | undefined
    • episodesWatched: number
    • anime: AnimeInfo

    Returns Promise<void>

unsubscribeAnime

  • unsubscribeAnime(animeID: string): Promise<void>
  • Unsubscribe from Anime

    Parameters

    • animeID: string

    Returns Promise<void>

Generated using TypeDoc