Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@rhysbrettbowen
Created July 3, 2013 14:31
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 rhysbrettbowen/5918435 to your computer and use it in GitHub Desktop.
Save rhysbrettbowen/5918435 to your computer and use it in GitHub Desktop.
AdviceFactory interface choices
// put in name:
Factory.register('MovableBoard', {
'base': 'WidgetBoard',
'widget': WidgetContainer,
'enterDocument.override': fn(){
},
'asdd.around': fn() {
},
'onClick': fn() {
}
});
// put on Function prototype
Factory.register('MovableBoard', {
'base': 'WidgetBoard',
'widget': WidgetContainer,
'enterDocument': (fn(){
}).override(),
'asdd': (fn() {
}).around(),
'onClick': fn() {
}
});
// Put in a function
Factory.register('MovableBoard', {
'base': 'WidgetBoard',
'widget': WidgetContainer,
'enterDocument': Factory.override(fn(){
}),
'asdd': Factory.around(fn() {
}),
'onClick': fn() {
}
});
// Put in separate objects
Factory.register('MovableBoard', {
'base': 'WidgetBoard',
'widget': WidgetContainer,
override: {
'enterDocument': fn(){
}
},
around: {
'asdd': fn() {
}
},
'onClick': fn() {
}
});
// define in another object
Factory.register('MovableBoard', {
'base': 'WidgetBoard',
'widget': WidgetContainer,
'enterDocument': fn(){
},
'asdd': fn() {
},
'onClick': fn() {
},
define: {
enterDocument: 'override',
asdd: 'around'
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment