[backend/memory][xs]: rename DataWrapper to Store.

This commit is contained in:
Rufus Pollock 2012-06-02 20:02:10 +01:00
parent 170f10268c
commit a6dff8ce28
2 changed files with 10 additions and 4 deletions

View File

@ -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) {

View File

@ -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 () {