Skip to content

Instantly share code, notes, and snippets.

@likr
Created April 8, 2015 09:48
Show Gist options
  • Save likr/3c12d162322e466eba6b to your computer and use it in GitHub Desktop.
Save likr/3c12d162322e466eba6b to your computer and use it in GitHub Desktop.
おれの考えた最強のD3.jsフレームワーク
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