All files / ima/meta MetaManagerImpl.js

63.16% Statements 12/19
0% Branches 0/6
46.15% Functions 6/13
63.16% Lines 12/19
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 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128      2x             4x             2x             2x             2x             2x             2x                           1x                                         1x                                         1x                                         1x       2x  
import ns from '../namespace';
import MetaManager from './MetaManager';
 
ns.namespace('ima.meta');
 
/**
 * Default implementation of the {@codelink MetaManager} interface.
 */
export default class MetaManagerImpl extends MetaManager {
  static get $dependencies() {
    return [];
  }
 
  /**
	 * Initializes the meta page attributes manager.
	 */
  constructor() {
    super();
 
    /**
		 * The page title.
		 *
		 * @type {string}
		 */
    this._title = '';
 
    /**
		 * Storage of generic meta information.
		 *
		 * @type {Map<string, string>}
		 */
    this._metaName = new Map();
 
    /**
		 * Storage of specialized meta information.
		 *
		 * @type {Map<string, string>}
		 */
    this._metaProperty = new Map();
 
    /**
		 * Storage of generic link information.
		 *
		 * @type {Map<string, string>}
		 */
    this._link = new Map();
  }
 
  /**
	 * @inheritdoc
	 */
  setTitle(title) {
    this._title = title;
  }
 
  /**
	 * @inheritdoc
	 */
  getTitle() {
    return this._title;
  }
 
  /**
	 * @inheritdoc
	 */
  setMetaName(name, value) {
    this._metaName.set(name, value);
  }
 
  /**
	 * @inheritdoc
	 */
  getMetaName(name) {
    return this._metaName.get(name) || '';
  }
 
  /**
	 * @inheritdoc
	 */
  getMetaNames() {
    return Array.from(this._metaName.keys());
  }
 
  /**
	 * @inheritdoc
	 */
  setMetaProperty(name, value) {
    this._metaProperty.set(name, value);
  }
 
  /**
	 * @inheritdoc
	 */
  getMetaProperty(name) {
    return this._metaProperty.get(name) || '';
  }
 
  /**
	 * @inheritdoc
	 */
  getMetaProperties() {
    return Array.from(this._metaProperty.keys());
  }
 
  /**
	 * @inheritdoc
	 */
  setLink(relation, value) {
    this._link.set(relation, value);
  }
 
  /**
	 * @inheritdoc
	 */
  getLink(relation) {
    return this._link.get(relation) || '';
  }
 
  /**
	 * @inheritdoc
	 */
  getLinks() {
    return Array.from(this._link.keys());
  }
}
 
ns.ima.meta.MetaManagerImpl = MetaManagerImpl;