UNPKG

1.65 kBTypeScriptView Raw
1import { IRenderMime } from '@jupyterlab/rendermime-interfaces';
2import { ReadonlyPartialJSONObject } from '@lumino/coreutils';
3/**
4 * The default mime model implementation.
5 */
6export declare class MimeModel implements IRenderMime.IMimeModel {
7 /**
8 * Construct a new mime model.
9 */
10 constructor(options?: MimeModel.IOptions);
11 /**
12 * Whether the model is trusted.
13 */
14 readonly trusted: boolean;
15 /**
16 * The data associated with the model.
17 */
18 get data(): ReadonlyPartialJSONObject;
19 /**
20 * The metadata associated with the model.
21 */
22 get metadata(): ReadonlyPartialJSONObject;
23 /**
24 * Set the data associated with the model.
25 *
26 * #### Notes
27 * Depending on the implementation of the mime model,
28 * this call may or may not have deferred effects,
29 */
30 setData(options: IRenderMime.IMimeModel.ISetDataOptions): void;
31 private _callback;
32 private _data;
33 private _metadata;
34}
35/**
36 * The namespace for MimeModel class statics.
37 */
38export declare namespace MimeModel {
39 /**
40 * The options used to create a mime model.
41 */
42 interface IOptions {
43 /**
44 * Whether the model is trusted. Defaults to `false`.
45 */
46 trusted?: boolean;
47 /**
48 * A callback function for when the data changes.
49 */
50 callback?: (options: IRenderMime.IMimeModel.ISetDataOptions) => void;
51 /**
52 * The initial mime data.
53 */
54 data?: ReadonlyPartialJSONObject;
55 /**
56 * The initial mime metadata.
57 */
58 metadata?: ReadonlyPartialJSONObject;
59 }
60}