Created
April 8, 2015 09:48
-
-
Save likr/3c12d162322e466eba6b to your computer and use it in GitHub Desktop.
おれの考えた最強のD3.jsフレームワーク
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
function nop() { | |
"use strict"; | |
} | |
module.exports = function createComponent(options) { | |
"use strict"; | |
var enter = options.enter || nop, | |
exit = options.exit || nop, | |
update = options.update || nop; | |
return function(root) { | |
root.each(function(data) { | |
var selection = d3.select(this).data(data); | |
selection | |
.enter() | |
.call(enter); | |
selection | |
.exit() | |
.call(exit); | |
root | |
.call(update); | |
}); | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment