UNPKG

1.86 kBTypeScriptView Raw
1/**
2 * An object which stores MIME data for general application use.
3 *
4 * #### Notes
5 * This class does not attempt to enforce "correctness" of MIME types
6 * and their associated data. Since this class is designed to transfer
7 * arbitrary data and objects within the same application, it assumes
8 * that the user provides correct and accurate data.
9 */
10export declare class MimeData {
11 /**
12 * Get an array of the MIME types contained within the dataset.
13 *
14 * @returns A new array of the MIME types, in order of insertion.
15 */
16 types(): string[];
17 /**
18 * Test whether the dataset has an entry for the given type.
19 *
20 * @param mime - The MIME type of interest.
21 *
22 * @returns `true` if the dataset contains a value for the given
23 * MIME type, `false` otherwise.
24 */
25 hasData(mime: string): boolean;
26 /**
27 * Get the data value for the given MIME type.
28 *
29 * @param mime - The MIME type of interest.
30 *
31 * @returns The value for the given MIME type, or `undefined` if
32 * the dataset does not contain a value for the type.
33 */
34 getData(mime: string): any | undefined;
35 /**
36 * Set the data value for the given MIME type.
37 *
38 * @param mime - The MIME type of interest.
39 *
40 * @param data - The data value for the given MIME type.
41 *
42 * #### Notes
43 * This will overwrite any previous entry for the MIME type.
44 */
45 setData(mime: string, data: any): void;
46 /**
47 * Remove the data entry for the given MIME type.
48 *
49 * @param mime - The MIME type of interest.
50 *
51 * #### Notes
52 * This is a no-op if there is no entry for the given MIME type.
53 */
54 clearData(mime: string): void;
55 /**
56 * Remove all data entries from the dataset.
57 */
58 clear(): void;
59 private _types;
60 private _values;
61}