diff --git a/src/backend/memory.js b/src/backend/memory.js index 60ef7811..f42aede6 100644 --- a/src/backend/memory.js +++ b/src/backend/memory.js @@ -15,7 +15,7 @@ this.recline.Backend.Memory = this.recline.Backend.Memory || {}; // @param metadata: (optional) dataset metadata - see recline.Model.Dataset. // If not defined (or id not provided) id will be autogenerated. my.createDataset = function(data, fields, metadata) { - var wrapper = new my.DataWrapper(data, fields); + var wrapper = new my.Store(data, fields); var backend = new my.Backbone(); var dataset = new recline.Model.Dataset(metadata, backend); dataset._dataCache = wrapper; @@ -29,7 +29,13 @@ this.recline.Backend.Memory = this.recline.Backend.Memory || {}; // Turn a simple array of JS objects into a mini data-store with // functionality like querying, faceting, updating (by ID) and deleting (by // ID). - my.DataWrapper = function(data, fields) { + // + // @param data list of hashes for each record/row in the data ({key: + // value, key: value}) + // @param fields (optional) list of field hashes (each hash defining a field + // as per recline.Model.Field). If fields not specified they will be taken + // from the data. + my.Store = function(data, fields) { var self = this; this.data = data; if (fields) { diff --git a/test/backend/memory.test.js b/test/backend/memory.test.js index 06e32e77..ed76f668 100644 --- a/test/backend/memory.test.js +++ b/test/backend/memory.test.js @@ -1,6 +1,6 @@ (function ($) { -module("Backend Memory - DataWrapper"); +module("Backend Memory - Store"); var memoryData = [ {id: 0, x: 1, y: 2, z: 3, country: 'DE', label: 'first'} @@ -13,7 +13,7 @@ var memoryData = [ var _wrapData = function() { var dataCopy = $.extend(true, [], memoryData); - return new recline.Backend.Memory.DataWrapper(dataCopy); + return new recline.Backend.Memory.Store(dataCopy); } test('basics', function () {