-
Notifications
You must be signed in to change notification settings - Fork 0
/
document-resource.js
58 lines (58 loc) · 1.56 KB
/
document-resource.js
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
*/
import { CacheMemory } from './services/cachememory';
import { Resource } from './resource';
import { Document } from './document';
// unsupported: template constraints.
/**
* @template R
*/
export class DocumentResource extends Document {
constructor() {
super(...arguments);
this.data = /** @type {?} */ (new Resource());
this.builded = false;
this.content = 'id';
}
/**
* @param {?} data_resource
* @return {?}
*/
fill(data_resource) {
this.builded = false;
this.content = 'id';
this.data_resource = data_resource;
if (data_resource === null) {
this.data = null;
return;
}
if (!this.data) {
this.data = /** @type {?} */ (CacheMemory.getInstance().getOrCreateResource(data_resource.data.type, data_resource.data.id));
}
if (this.data.fill(data_resource)) {
this.builded = true;
this.content = 'resource';
}
this.meta = data_resource.meta || {};
}
/**
* @return {?}
*/
unsetData() {
this.data = undefined;
this.builded = false;
}
}
if (false) {
/** @type {?} */
DocumentResource.prototype.data;
/** @type {?} */
DocumentResource.prototype.builded;
/** @type {?} */
DocumentResource.prototype.content;
/** @type {?} */
DocumentResource.prototype.data_resource;
}
//# sourceMappingURL=document-resource.js.map