Last active
August 29, 2015 13:56
-
-
Save mrgenixus/9098239 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 resolve(cb, res){ | |
| $.when(res).then(cb) | |
| } | |
| //usage: | |
| function definePurpleEventually(cb){ | |
| setTimeout(function(){ | |
| cb({ | |
| purple: "color" | |
| }) | |
| }, 1000); | |
| } | |
| function getPurpleDef(cb) { | |
| cb($.ajax('/purple')); | |
| } | |
| function whatIsPurple(purpleDef){ | |
| console.log(purpleDef.purple); | |
| } | |
| definePurpleEventually(_.partial(resolve, whatIsPurple)); | |
| getPurple(_.partial(resolve, whatIsPurple)); | |
| //There has GOT be be a better idiom! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment