Skip to content

Instantly share code, notes, and snippets.

@sfoster
Created October 5, 2011 00:28
Show Gist options
  • Save sfoster/1263265 to your computer and use it in GitHub Desktop.
Save sfoster/1263265 to your computer and use it in GitHub Desktop.
define(['compose'], function(Compose){
var cache = {};
exports = Compose(Compose, function(){
var id = this.id = MyClass.nextId();
cache[id] = {};
}, {
someMethod: function(){
var id = this.id,
data = cache[id].someResult || (cache[id].someResult = expensivelyFetchResult())
}
});
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment