1 | /**
|
2 | * The default mime model implementation.
|
3 | */
|
4 | export class MimeModel {
|
5 | /**
|
6 | * Construct a new mime model.
|
7 | */
|
8 | constructor(options = {}) {
|
9 | this.trusted = !!options.trusted;
|
10 | this._data = options.data || {};
|
11 | this._metadata = options.metadata || {};
|
12 | this._callback = options.callback || Private.noOp;
|
13 | }
|
14 | /**
|
15 | * The data associated with the model.
|
16 | */
|
17 | get data() {
|
18 | return this._data;
|
19 | }
|
20 | /**
|
21 | * The metadata associated with the model.
|
22 | */
|
23 | get metadata() {
|
24 | return this._metadata;
|
25 | }
|
26 | /**
|
27 | * Set the data associated with the model.
|
28 | *
|
29 | * #### Notes
|
30 | * Depending on the implementation of the mime model,
|
31 | * this call may or may not have deferred effects,
|
32 | */
|
33 | setData(options) {
|
34 | this._data = options.data || this._data;
|
35 | this._metadata = options.metadata || this._metadata;
|
36 | this._callback(options);
|
37 | }
|
38 | }
|
39 | /**
|
40 | * The namespace for module private data.
|
41 | */
|
42 | var Private;
|
43 | (function (Private) {
|
44 | /**
|
45 | * A no-op callback function.
|
46 | */
|
47 | function noOp() {
|
48 | /* no-op */
|
49 | }
|
50 | Private.noOp = noOp;
|
51 | })(Private || (Private = {}));
|
52 | //# sourceMappingURL=mimemodel.js.map |
\ | No newline at end of file |