1 define(function(require) {
5 var _ = require('libs/underscore'),
6 metadataKey = 'wlxml.metadata';
10 getMetadata: function() {
11 return this.getData(metadataKey) || [];
15 var transformations = {
16 addMetadataRow: function(row) {
17 this.setMetadataRow(null, row);
20 setMetadataRow: function(index, row) {
21 var metadata = this.getData(metadataKey) || [];
22 if(typeof index !== 'number' || index > metadata.length - 1) {
24 index = metadata.length - 1;
26 metadata[index] = _.extend(metadata[index], row);
28 this.setData(metadataKey, metadata);
29 this.triggerChangeEvent('metadataChange', {index: index});
36 transformations: transformations,