Iterate
This commit is contained in:
@@ -53,4 +53,19 @@ export function isModule(module: unknown): module is ModuleExport {
|
||||
);
|
||||
}
|
||||
|
||||
export interface Api extends LegacyModuleApiExtension, LegacyCustomisationsApiExtension {}
|
||||
export interface Config {
|
||||
// The branding name of the application
|
||||
brand: string;
|
||||
// Other config options are available but not specified in the types as that would make it difficult to change for element-web
|
||||
// they are accessible at runtime all the same, see list at https://github.com/element-hq/element-web/blob/develop/docs/config.md
|
||||
}
|
||||
|
||||
export interface ConfigApi {
|
||||
get(): Config;
|
||||
get<K extends keyof Config>(key: K): Config[K];
|
||||
get<K extends keyof Config = never>(key?: K): Config | Config[K];
|
||||
}
|
||||
|
||||
export interface Api extends LegacyModuleApiExtension, LegacyCustomisationsApiExtension {
|
||||
config: ConfigApi;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,6 @@ Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
export { ModuleLoader, ModuleIncompatibleError } from "./loader";
|
||||
export type { Api, Module, ModuleFactory } from "./api";
|
||||
export type { Api, Module, ModuleFactory, Config, ConfigApi } from "./api";
|
||||
export type * from "./legacy-modules";
|
||||
export type * from "./legacy-customisations";
|
||||
|
||||
@@ -77,12 +77,12 @@ export interface Media {
|
||||
downloadSource(): Promise<Response>;
|
||||
}
|
||||
|
||||
export interface MediaContructable<Thumbnail, File> {
|
||||
new (prepared: { mxc: string; thumbnail?: Thumbnail; file?: File }): Media;
|
||||
export interface MediaContructable<PreparedMedia> {
|
||||
new (prepared: PreparedMedia): Media;
|
||||
}
|
||||
|
||||
export interface MediaCustomisations<Content, Client, Thumbnail, File> {
|
||||
readonly Media: MediaContructable<Thumbnail, File>;
|
||||
export interface MediaCustomisations<Content, Client, PreparedMedia> {
|
||||
readonly Media: MediaContructable<PreparedMedia>;
|
||||
mediaFromContent(content: Content, client?: Client): Media;
|
||||
mediaFromMxc(mxc?: string, client?: Client): Media;
|
||||
}
|
||||
@@ -182,7 +182,7 @@ export interface LegacyCustomisationsApiExtension {
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
readonly _registerLegacyMediaCustomisations: LegacyCustomisations<MediaCustomisations<never, never, never, never>>;
|
||||
readonly _registerLegacyMediaCustomisations: LegacyCustomisations<MediaCustomisations<never, never, never>>;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user