Skip to content

Instantly share code, notes, and snippets.

@h4
Created August 28, 2014 12:34
Show Gist options
  • Save h4/7c86b700bd91d4add059 to your computer and use it in GitHub Desktop.
Save h4/7c86b700bd91d4add059 to your computer and use it in GitHub Desktop.
/**
* Data collection class
* @param serialized
* @param promise
* @constructor
*/
var Data = function(serialized, promise) {
serialized || (serialized = {});
this._promise = promise;
var Data = function() {
$.extend(this, serialized);
};
Data.prototype = this;
return new Data();
};
Data.prototype.getPromise = function() {
return this._promise;
};
Data.prototype.getValues = function() {
var result = {};
for (var prop in this) {
if (this.hasOwnProperty(prop)) {
result[prop] = this[prop];
}
}
return result;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment