Created
March 28, 2013 00:17
-
-
Save JohnDMathis/5259401 to your computer and use it in GitHub Desktop.
It would be very helpful to be able to use request/response with context ("this") properly filled and available in the response function. Is this possible? In the example below, "this" is a reference to the instance 'someView'.
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.views.SomeView=Marionette.ItemView.extend({ | |
initialize:function(){ | |
this.fud = "-quux"; | |
App.reqres.setHandler("foo", function(bar){ | |
return bar + this.fud; | |
}, this); | |
} | |
}); | |
var someView = new App.views.SomeView(); | |
// and then: | |
var resp = App.request("foo", "bud"); | |
// resp should be "bud-quux" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment