Skip to content

Instantly share code, notes, and snippets.

@thurt
Created February 10, 2016 15:58
Show Gist options
  • Save thurt/c654dd88e3981f410d50 to your computer and use it in GitHub Desktop.
Save thurt/c654dd88e3981f410d50 to your computer and use it in GitHub Desktop.
Simple Data Warehouse
var Data = function() {
var warehouse = {};
var count = 1;
return {
reset: function() {
count = 1;
warehouse = {};
},
set: function (dom, data) {
if (!dom.__data) {
dom.__data = "hello" + count++;
}
warehouse[dom.__data] = data;
},
get: function(dom) {
return warehouse[dom.__data];
}
};
}();
@thurt
Copy link
Author

thurt commented Feb 10, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment