Skip to content

Instantly share code, notes, and snippets.

@jonathan
Created June 1, 2016 19:11
Show Gist options
  • Save jonathan/2f9c72f449f0dba282457520ead20eb7 to your computer and use it in GitHub Desktop.
Save jonathan/2f9c72f449f0dba282457520ead20eb7 to your computer and use it in GitHub Desktop.
var pubsub = new PubSub();
class DataStore {
catalogFiles = null,
init: function() {
var promise = new $.Promise();
getCatalogFiles();
},
getCatalogFiles() {
var that = this;
$.ajax({}).done(function() {
that.catalogFiles = response.catalog;
pubsub.publish('datastore.change.catalog_files', that.catalogFiles);
});
}
};
var ds = new DataStore;
var dm = null;
pubsub.subscribe('datastore.loadData', function() {
ds.init();
});
pubsub.subscribe('datastore.change.catalog_files', function(catalogFiles) {
dm = new DataMapper({
inFiles = catalogFiles
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment