Created
January 24, 2016 12:11
-
-
Save adamay000/1a550028945d6161e763 to your computer and use it in GitHub Desktop.
intern_description
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var main = require('./module/main.js'); | |
main.load('assets/js/data.json'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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