UNPKG

2.45 kBJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6
7var _MetaManager = require("./MetaManager");
8
9var _MetaManager2 = _interopRequireDefault(_MetaManager);
10
11function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
13/**
14 * Default implementation of the {@codelink MetaManager} interface.
15 */
16class MetaManagerImpl extends _MetaManager2.default {
17 static get $dependencies() {
18 return [];
19 }
20 /**
21 * Initializes the meta page attributes manager.
22 */
23
24
25 constructor() {
26 super();
27 /**
28 * The page title.
29 *
30 * @type {string}
31 */
32
33 this._title = '';
34 /**
35 * Storage of generic meta information.
36 *
37 * @type {Map<string, string>}
38 */
39
40 this._metaName = new Map();
41 /**
42 * Storage of specialized meta information.
43 *
44 * @type {Map<string, string>}
45 */
46
47 this._metaProperty = new Map();
48 /**
49 * Storage of generic link information.
50 *
51 * @type {Map<string, string>}
52 */
53
54 this._link = new Map();
55 }
56 /**
57 * @inheritdoc
58 */
59
60
61 setTitle(title) {
62 this._title = title;
63 }
64 /**
65 * @inheritdoc
66 */
67
68
69 getTitle() {
70 return this._title;
71 }
72 /**
73 * @inheritdoc
74 */
75
76
77 setMetaName(name, value) {
78 this._metaName.set(name, value);
79 }
80 /**
81 * @inheritdoc
82 */
83
84
85 getMetaName(name) {
86 return this._metaName.get(name) || '';
87 }
88 /**
89 * @inheritdoc
90 */
91
92
93 getMetaNames() {
94 return Array.from(this._metaName.keys());
95 }
96 /**
97 * @inheritdoc
98 */
99
100
101 setMetaProperty(name, value) {
102 this._metaProperty.set(name, value);
103 }
104 /**
105 * @inheritdoc
106 */
107
108
109 getMetaProperty(name) {
110 return this._metaProperty.get(name) || '';
111 }
112 /**
113 * @inheritdoc
114 */
115
116
117 getMetaProperties() {
118 return Array.from(this._metaProperty.keys());
119 }
120 /**
121 * @inheritdoc
122 */
123
124
125 setLink(relation, value) {
126 this._link.set(relation, value);
127 }
128 /**
129 * @inheritdoc
130 */
131
132
133 getLink(relation) {
134 return this._link.get(relation) || '';
135 }
136 /**
137 * @inheritdoc
138 */
139
140
141 getLinks() {
142 return Array.from(this._link.keys());
143 }
144
145}
146
147exports.default = MetaManagerImpl;
148
149typeof $IMA !== 'undefined' && $IMA !== null && $IMA.Loader && $IMA.Loader.register('ima/meta/MetaManagerImpl', [], function (_export, _context) {
150 'use strict';
151 return {
152 setters: [],
153 execute: function () {
154 _export('default', exports.default);
155 }
156 };
157});