genshin-manager
Version:
<div align="center"> <p> <a href="https://www.npmjs.com/package/genshin-manager"><img src="https://img.shields.io/npm/v/genshin-manager.svg?maxAge=3600" alt="npm version" /></a> <a href="https://www.npmjs.com/package/genshin-manager"><img src="https:
102 lines (101 loc) • 2.54 kB
TypeScript
import { Notice } from '../models/Notice';
import { NoticeLanguage, URLParams as URLParams } from '../types/sg-hk4e-api';
import { PromiseEventEmitter } from '../utils/PromiseEventEmitter';
/**
* NoticeManager events
* @see {@link NoticeManager}
*/
export declare enum NoticeManagerEvents {
/**
* When a notice is added, fires
* @event ADD_NOTICE
* @listener
* | param | type | description |
* | --- | --- | --- |
* | notice | {@link Notice} | Added Notice |
*/
ADD_NOTICE = "ADD_NOTICE",
/**
* When a notice is removed, fires
* @event REMOVE_NOTICE
* @listener
* | param | type | description |
* | --- | --- | --- |
* | notice | {@link Notice} | Removed Notice |
*/
REMOVE_NOTICE = "REMOVE_NOTICE"
}
interface NoticeManagerEventMap {
ADD_NOTICE: [notice: Notice];
REMOVE_NOTICE: [notice: Notice];
}
/**
* Class for fetching notices from mihoyo
*/
export declare class NoticeManager extends PromiseEventEmitter<NoticeManagerEventMap, NoticeManagerEvents> {
/**
* Minimum update interval(ms)
* @default 1 minute
*/
private static readonly MIN_UPDATE_INTERVAL;
/**
* URL of getAnnContent
*/
private static readonly GIT_CONTENT_URL;
/**
* URL of getAnnList
*/
private static readonly GIT_LIST_URL;
/**
* Default URL params
*/
private static readonly defaultURLParams;
/**
* Language of notices
*/
readonly language: keyof typeof NoticeLanguage;
/**
* Update interval(ms)
*/
readonly updateInterval: number | undefined;
/**
* Notices
* @key Notice ID
* @value Notice
*/
readonly notices: Map<number, Notice>;
/**
* URL params
*/
private readonly urlParams;
/**
* Create a NoticeManager
* @param language Language of notices
* @param updateInterval Update interval(ms) Min: 1 minute
* @param urlParams URL params
*/
constructor(language: keyof typeof NoticeLanguage, updateInterval?: number, urlParams?: Partial<URLParams>);
/**
* Update notices
*/
update(): Promise<void>;
/**
* Get AnnContent
* @param lang Language of notices
* @returns AnnContent
*/
private getAnnContent;
/**
* Get AnnList
* @returns AnnList
*/
private getAnnList;
/**
* Get Ann
* @param urlText URL
* @param lang Language of notices
* @returns Ann
*/
private _getAnn;
}
export {};