-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathindex.d.ts
28 lines (27 loc) · 1.1 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { BackendModule, Services, ReadCallback, MultiReadCallback, InitOptions } from 'i18next';
export interface FetchOptions {
loadPath: string,
addPath: string,
multiSeparator: string,
allowMultiLoading: boolean,
fetch: typeof fetch,
parse: typeof JSON.parse,
stringify: typeof JSON.stringify,
requestOptions: RequestInit,
}
export class BackendError extends Error { }
export default class Backend implements BackendModule<FetchOptions> {
type: 'backend';
static type: 'backend';
constructor(services: Services, options: FetchOptions);
init(services: Services, backendOptions: FetchOptions, i18nextOptions: InitOptions): void;
create(languages: string[], namespace: string, key: string, fallbackValue: string): void;
/**
* @throws {BackendError} - If the fetch fails or the parsing the response to json fails.
*/
read(language: string, namespace: string, callback: ReadCallback): void;
/**
* @throws {BackendError} - If the fetch fails or the parsing the response to json fails.
*/
readMulti(languages: string[], namespaces: string[], callback: MultiReadCallback): void;
}