Last active
December 11, 2015 00:48
-
-
Save philmander/4518684 to your computer and use it in GitHub Desktop.
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
//app-config.js | |
define(function() { | |
return { | |
protos: { | |
movieLister: { | |
module: "movies/movie-lister", | |
args: [ | |
"*movieFinder" | |
] | |
mixin: { | |
ref: "movieViewer", | |
override: false | |
} | |
}, | |
movieViewer: { | |
module: "movie/movie-" | |
} | |
} | |
}; | |
}); |
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
//mixin function | |
var mixin = function(toMix, mixWith, toMixId, override) { | |
override = typeof override === "boolean" ? override : true; | |
for(var fn in mixWith) { | |
if(typeof mixWith[fn] === "function" && | |
(!(fn in toMix) || (fn in toMix && override))) { | |
(function(fn) { | |
toMix[fn] = function() { | |
return mixWith[fn].apply(mixWith, arguments); | |
}; | |
})(fn); | |
} | |
} | |
toMix["__" + toMixId + "__"] = mixWith; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment