Skip to content

Commit

Permalink
improve the memora management (refs #9)
Browse files Browse the repository at this point in the history
  • Loading branch information
xavierlacot committed Jun 21, 2012
1 parent 0d96a5b commit 6ea1cf2
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions joli.js
Expand Up @@ -715,11 +715,9 @@ var joliCreator = function() {

joli.record = function(table) {
this._options = {
table: table,
columns: table.getColumns()
table: table
};
this._data = {};
this._metadata = {};
};

joli.record.prototype = {
Expand All @@ -745,7 +743,7 @@ var joliCreator = function() {
};
}

joli.each(this._options.columns, function(colType, colName) {
joli.each(this._options.table.getColumns(), function(colType, colName) {
this[colName] = null;
this[colName] = data[colName];
this._data[colName] = null;
Expand All @@ -770,7 +768,6 @@ var joliCreator = function() {
save: function() {
var data = {
data: this._data,
metadata: this._metadata
};

if (this.isChanged()) {
Expand All @@ -789,7 +786,7 @@ var joliCreator = function() {
this._originalData = {};
var newData = {};

joli.each(this._options.columns, function(colType, colName) {
joli.each(this._options.table.getColumns(), function(colType, colName) {
this._originalData[colName] = this._data[colName];
newData[colName] = this._data[colName];
this[colName] = this._data[colName];
Expand All @@ -809,7 +806,7 @@ var joliCreator = function() {
toArray: function() {
var result = [];

joli.each(this._options.columns, function(colType, colName) {
joli.each(this._options.table.getColumns(), function(colType, colName) {
result[colName] = this._data[colName];
}, this);
return result;
Expand Down

0 comments on commit 6ea1cf2

Please sign in to comment.