Skip to content

Instantly share code, notes, and snippets.

@adamay000
Created January 24, 2016 12:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamay000/1a550028945d6161e763 to your computer and use it in GitHub Desktop.
Save adamay000/1a550028945d6161e763 to your computer and use it in GitHub Desktop.
intern_description
var main = require('./module/main.js');
main.load('assets/js/data.json');
var Main = function() {
// コンストラクタ
this.cardArray = [];
};
Main.prototype.load = function(jsonPath) {
$.getJSON(jsonPath, this.init.bind(this));
};
Main.prototype.init = function(data) {
this.data = data;
this.childNumber = data.contents.length;
console.log('childNumber:', this.childNumber);
this.createCards();
};
Main.prototype.createCards = function() {
for(var i = 0; i < this.childNumber; i++) {
this.cardArray.push("<li></li>");
}
};
module.exports = new Main();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment