Created
April 7, 2015 14:35
-
-
Save Shinpeim/73dd1f7f623677df57de to your computer and use it in GitHub Desktop.
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
// さらに、notesの初期化はコンストラクタでやれば | |
// if 文が減らせて、複雑性が減り、バグを入れ込みにくくなる | |
function Key(){ | |
// snip | |
this.notes = []; | |
// snip | |
} | |
Key.prototype.renderTo = function(cssId) { | |
for(var i=0; i < this.notes.length; i++){ | |
var selector = cssId + " ." + this.notes[i]; | |
$(selector).addClass("osu"); | |
} | |
}; | |
key1.renderTo("#key1"); | |
key2.renderTo("#key1"); | |
key3.renderTo("#key1"); | |
key4.renderTo("#key1"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment