MacViews: Get c/b/ui/views/tabs to build on Mac
[chromium-blink-merge.git] / third_party / polymer / components-chromium / core-meta / core-meta-extracted.js
blobc4e60a332ca65c8bb076e165d81818b800c350d0
3 (function() {
5 var SKIP_ID = 'meta';
6 var metaData = {}, metaArray = {};
8 Polymer('core-meta', {
10 /**
11 * The type of meta-data. All meta-data with the same type with be
12 * stored together.
14 * @attribute type
15 * @type string
16 * @default 'default'
18 type: 'default',
20 alwaysPrepare: true,
22 ready: function() {
23 this.register(this.id);
26 get metaArray() {
27 var t = this.type;
28 if (!metaArray[t]) {
29 metaArray[t] = [];
31 return metaArray[t];
34 get metaData() {
35 var t = this.type;
36 if (!metaData[t]) {
37 metaData[t] = {};
39 return metaData[t];
42 register: function(id, old) {
43 if (id && id !== SKIP_ID) {
44 this.unregister(this, old);
45 this.metaData[id] = this;
46 this.metaArray.push(this);
50 unregister: function(meta, id) {
51 delete this.metaData[id || meta.id];
52 var i = this.metaArray.indexOf(meta);
53 if (i >= 0) {
54 this.metaArray.splice(i, 1);
58 /**
59 * Returns a list of all meta-data elements with the same type.
61 * @property list
62 * @type array
63 * @default []
65 get list() {
66 return this.metaArray;
69 /**
70 * Retrieves meta-data by ID.
72 * @method byId
73 * @param {String} id The ID of the meta-data to be returned.
74 * @returns Returns meta-data.
76 byId: function(id) {
77 return this.metaData[id];
80 });
82 })();