Class NoticeManager

Class for fetching notices from mihoyo

Hierarchy

Constructors

  • Create a NoticeManager

    Parameters

    • language:
          | "id"
          | "zh-tw"
          | "zh-cn"
          | "en"
          | "ru"
          | "vi"
          | "th"
          | "pt"
          | "ko"
          | "ja"
          | "fr"
          | "es"
          | "de"

      Language of notices

    • OptionalupdateInterval: number

      Update interval(ms) Min: 1 minute

    • OptionalurlParams: Partial<URLParams>

      URL params

    Returns NoticeManager

Properties

language:
    | "id"
    | "zh-tw"
    | "zh-cn"
    | "en"
    | "ru"
    | "vi"
    | "th"
    | "pt"
    | "ko"
    | "ja"
    | "fr"
    | "es"
    | "de"

Language of notices

notices: Map<number, Notice> = ...

Notices

Notice ID

Notice

updateInterval: undefined | number

Update interval(ms)

Methods

  • Alias for emitter.on(eventName, listener).

    Type Parameters

    • K

    Parameters

    • eventName: NoticeManagerEvents | (keyof NoticeManagerEventMap) | K

      The name of the event.

    • listener: K extends keyof NoticeManagerEventMap
          ? NoticeManagerEventMap[K<K>] extends unknown[]
              ? ((...args: NoticeManagerEventMap[K<K>]) => Awaitable<void>)
              : never
          : never

      The callback function. (supports async)

    Returns this

    EventEmitter.addListener()

  • Synchronously calls each of the listeners registered for the event namedeventName, in the order they were registered, passing the supplied arguments to each. Returns true if the event had listeners, false otherwise.

    Type Parameters

    • K

    Parameters

    • eventName: NoticeManagerEvents | (keyof NoticeManagerEventMap) | K

      The name of the event.

    • Rest...args: K extends keyof NoticeManagerEventMap
          ? NoticeManagerEventMap[K<K>]
          : never

      Arguments to pass to the listeners.

    Returns boolean

    EventEmitter.emit()

  • Alias for emitter.removeListener().

    Type Parameters

    • K

    Parameters

    • eventName: NoticeManagerEvents | (keyof NoticeManagerEventMap) | K

      The name of the event.

    • listener: K extends keyof NoticeManagerEventMap
          ? NoticeManagerEventMap[K<K>] extends unknown[]
              ? ((...args: NoticeManagerEventMap[K<K>]) => Awaitable<void>)
              : never
          : never

      The callback function. (supports async)

    Returns this

    EventEmitter.off()

  • Adds the listener function to the end of the listeners array for the event named eventName. No checks are made to see if the listener has already been added. Multiple calls passing the same combination of eventNameand listener will result in the listener being added, and called, multiple times.

    Type Parameters

    • K

    Parameters

    • eventName: NoticeManagerEvents | (keyof NoticeManagerEventMap) | K

      The name of the event.

    • listener: K extends keyof NoticeManagerEventMap
          ? NoticeManagerEventMap[K<K>] extends unknown[]
              ? ((...args: NoticeManagerEventMap[K<K>]) => Awaitable<void>)
              : never
          : never

      The callback function. (supports async)

    Returns this

    EventEmitter.on()

  • Adds a one-timelistener function for the event named eventName. The next time eventName is triggered, this listener is removed and then invoked.

    Type Parameters

    • K

    Parameters

    • eventName: NoticeManagerEvents | (keyof NoticeManagerEventMap) | K

      The name of the event.

    • listener: K extends keyof NoticeManagerEventMap
          ? NoticeManagerEventMap[K<K>] extends unknown[]
              ? ((...args: NoticeManagerEventMap[K<K>]) => Awaitable<void>)
              : never
          : never

      The callback function. (supports async)

    Returns this

    EventEmitter.once()

  • Removes all listeners, or those of the specified eventName.

    Type Parameters

    • K

    Parameters

    Returns this

    EventEmitter.removeAllListeners()

  • Removes the specified listener from the listener array for the event namedeventName.

    Type Parameters

    • K

    Parameters

    • eventName: NoticeManagerEvents | (keyof NoticeManagerEventMap) | K

      The name of the event.

    • listener: K extends keyof NoticeManagerEventMap
          ? NoticeManagerEventMap[K<K>] extends unknown[]
              ? ((...args: NoticeManagerEventMap[K<K>]) => Awaitable<void>)
              : never
          : never

      The callback function. (supports async)

    Returns this

    EventEmitter.removeListener()

  • Update notices

    Returns Promise<void>