This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function extendComponent(constructor) { | |
// Don't do anything if the constructor already extends Component | |
if (constructor.prototype instanceof Component) | |
return; | |
// Otherwise, add an instance of Component to its prototype chain | |
var c = constructor.prototype; | |
for (var p = Object.getPrototypeOf(c); p !== Object.prototype && p !== Function.prototype; p = Object.getPrototypeOf(c)) { | |
c = p; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# a simple function, but this will make real-time updates impossible | |
# it also causes DerbyJS to create new components with every keystroke | |
# get all subitems in item.attr -- and dereference them if needed | |
subitems: (item, attr) -> | |
data = item[attr.id] | |
return [] if not data | |
if not attr.multi | |
data = [data] |