Mercurial > pub > ImplabJs
diff src/implab/data/StatefullStoreAdapter.js @ 0:fc2517695ee1
Initial commit, draft import of existing work
author | cin |
---|---|
date | Thu, 01 Jun 2017 13:20:03 +0300 |
parents | |
children | 93fb6c09f2e1 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/implab/data/StatefullStoreAdapter.js Thu Jun 01 13:20:03 2017 +0300 @@ -0,0 +1,19 @@ +define(["dojo/_base/declare", "dojo/_base/array", "core/safe", "./StoreAdapter"], function(declare, array, safe ,AdapterStore){ + return declare([AdapterStore], { + _attrs : null, + + constructor : function(opts) { + safe.argumentNotEmptyArray(opts.attrs, "opts.attrs"); + this._attrs = opts.attrs; + }, + + mapItem : function(item) { + var result = {}; + array.forEach(this._attrs, function(p) { + result[p] = item.get(p); + }); + return result; + } + }); + +}); \ No newline at end of file