Skip to content

Instantly share code, notes, and snippets.

@zidom
Last active March 4, 2017 13:39
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 zidom/69d7e73940207fc0ace5576c5f8ae59c to your computer and use it in GitHub Desktop.
Save zidom/69d7e73940207fc0ace5576c5f8ae59c to your computer and use it in GitHub Desktop.
fresh block
license: mit
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<script src="https://d3js.org/d3.v4.min.js"></script>
<style>
body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; }
</style>
</head>
<body>
<script>
functon SimpleWidgit(dest){
var instance = {};
var headline, description;
instance.render = function(){
var div = d3.select('body').append('div');
div.append('h3').text(headline);
div.attr('class','box')
.attr('style', 'color:' + spec.color)
.append('p')
text(description);
return instance;
};
instance.headline = function(h){
if(!arguments.length) h;
headline = h;
return instance;
};
instance.description = function(desc){
if(!arguments.length) desc;
description = desc;
return instance;
};
return instance;
}
var widget = SimpleWidget({color:'#6495ed'})
.headline("Simple Widget")
.description('This is test Widget!!!!');
widget.render();
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment