Skip to content
This repository was archived by the owner on Mar 13, 2018. It is now read-only.

Commit 831e43e

Browse files
committed
ws
1 parent e1b9af2 commit 831e43e

File tree

1 file changed

+78
-81
lines changed

1 file changed

+78
-81
lines changed

core-meta.html

+78-81
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
-->
99

1010
<!--
11-
1211
`core-meta` provides a method of constructing a self-organizing database.
1312
It is useful to collate element meta-data for things like catalogs and for
1413
designer.
@@ -59,90 +58,88 @@
5958
<link rel="import" href="../polymer/polymer.html">
6059

6160
<polymer-element name="core-meta" attributes="list label type">
61+
<script>
6262

63-
<script>
64-
65-
(function() {
63+
(function() {
64+
65+
var SKIP_ID = 'meta';
66+
var metaData = {}, metaArray = {};
67+
68+
Polymer('core-meta', {
6669

67-
var SKIP_ID = 'meta';
68-
var metaData = {}, metaArray = {};
69-
70-
Polymer('core-meta', {
71-
72-
/**
73-
* The type of meta-data. All meta-data with the same type with be
74-
* stored together.
75-
*
76-
* @attribute type
77-
* @type string
78-
* @default 'default'
79-
*/
80-
type: 'default',
81-
82-
alwaysPrepare: true,
83-
84-
ready: function() {
85-
this.register(this.id);
86-
},
87-
88-
get metaArray() {
89-
var t = this.type;
90-
if (!metaArray[t]) {
91-
metaArray[t] = [];
92-
}
93-
return metaArray[t];
94-
},
95-
96-
get metaData() {
97-
var t = this.type;
98-
if (!metaData[t]) {
99-
metaData[t] = {};
100-
}
101-
return metaData[t];
102-
},
103-
104-
register: function(id, old) {
105-
if (id && id !== SKIP_ID) {
106-
this.unregister(this, old);
107-
this.metaData[id] = this;
108-
this.metaArray.push(this);
109-
}
110-
},
111-
112-
unregister: function(meta, id) {
113-
delete this.metaData[id || meta.id];
114-
var i = this.metaArray.indexOf(meta);
115-
if (i >= 0) {
116-
this.metaArray.splice(i, 1);
117-
}
118-
},
119-
120-
/**
121-
* Returns a list of all meta-data elements with the same type.
122-
*
123-
* @attribute list
124-
* @type array
125-
* @default []
126-
*/
127-
get list() {
128-
return this.metaArray;
129-
},
130-
131-
/**
132-
* Retrieves meta-data by ID.
133-
*
134-
* @method byId
135-
* @param {String} id The ID of the meta-data to be returned.
136-
* @returns Returns meta-data.
137-
*/
138-
byId: function(id) {
139-
return this.metaData[id];
70+
/**
71+
* The type of meta-data. All meta-data with the same type with be
72+
* stored together.
73+
*
74+
* @attribute type
75+
* @type string
76+
* @default 'default'
77+
*/
78+
type: 'default',
79+
80+
alwaysPrepare: true,
81+
82+
ready: function() {
83+
this.register(this.id);
84+
},
85+
86+
get metaArray() {
87+
var t = this.type;
88+
if (!metaArray[t]) {
89+
metaArray[t] = [];
14090
}
141-
142-
});
91+
return metaArray[t];
92+
},
93+
94+
get metaData() {
95+
var t = this.type;
96+
if (!metaData[t]) {
97+
metaData[t] = {};
98+
}
99+
return metaData[t];
100+
},
101+
102+
register: function(id, old) {
103+
if (id && id !== SKIP_ID) {
104+
this.unregister(this, old);
105+
this.metaData[id] = this;
106+
this.metaArray.push(this);
107+
}
108+
},
109+
110+
unregister: function(meta, id) {
111+
delete this.metaData[id || meta.id];
112+
var i = this.metaArray.indexOf(meta);
113+
if (i >= 0) {
114+
this.metaArray.splice(i, 1);
115+
}
116+
},
117+
118+
/**
119+
* Returns a list of all meta-data elements with the same type.
120+
*
121+
* @attribute list
122+
* @type array
123+
* @default []
124+
*/
125+
get list() {
126+
return this.metaArray;
127+
},
128+
129+
/**
130+
* Retrieves meta-data by ID.
131+
*
132+
* @method byId
133+
* @param {String} id The ID of the meta-data to be returned.
134+
* @returns Returns meta-data.
135+
*/
136+
byId: function(id) {
137+
return this.metaData[id];
138+
}
143139

144-
})();
140+
});
145141

146-
</script>
142+
})();
147143

144+
</script>
148145
</polymer-element>

0 commit comments

Comments
 (0)