Skip to content

Instantly share code, notes, and snippets.

@biovisualize
Created July 21, 2017 15:56
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 biovisualize/af7e5e5f96a70b7cc8499c06cceb003b to your computer and use it in GitHub Desktop.
Save biovisualize/af7e5e5f96a70b7cc8499c06cceb003b to your computer and use it in GitHub Desktop.
Empty interface example - refactoring blog post
var chartManager = {}
chartManager.line = function(selector) {
var config = {
height: 200,
width: 200
}
var dataCache = []
var events = function(eventName, cb) {
}
function render() {
}
function setConfig(newConfig) {
Object.assign(config, newConfig)
}
function setData(data) {
dataCache = data
render()
}
return {
config: setConfig,
on: events,
data: setData,
render: render
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment