Skip to content

Instantly share code, notes, and snippets.

@michaelobriena
Created July 24, 2014 19:29
Show Gist options
  • Select an option

  • Save michaelobriena/d0bbc1419bbe89d51a74 to your computer and use it in GitHub Desktop.

Select an option

Save michaelobriena/d0bbc1419bbe89d51a74 to your computer and use it in GitHub Desktop.
var NextButton = require('NextButton');
var PreviousButton = require('PreviousButton');
var MenuButton = require('MenuButton');
var registry = {
'next': NextButton,
'previous': PreviousButton,
'menu': MenuButton
};
module.exports = {
register: function(key, constructor) {
registry[key] = constructor
},
get: function(key) {
return constructor
}
}
------------------------------------
Header() {
this.sections = {}
this.buttons = {};
this.leftButton = new RC();
this.rightButton = new RC();
}
HEader.p.handleSectionChange = function(id) {
if (this.sections[id].leftButton) {
if (!this.buttons[this.sections[id].leftButton]) {
this.buttons[this.sections[id].leftBUtton] = new HeaderButtonRegistry.get(this.sections[id].leftBUtton)()
}
this.leftBUtton.show(this.buttons[this.sections[id].leftBUtton])
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment