Created
November 16, 2013 03:00
-
-
Save jasonkarns/7495384 to your computer and use it in GitHub Desktop.
What if _.tap could set the context of the interceptor? I would imagine that it would set the context to the tapped object by default. I can't think of a use case for setting it to another arbitrary object.
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
# the thought came to me when dealing with angular | |
myModule = angular.module('myModule', []) | |
myModule.value 'X', X | |
myModule.factory 'F', F | |
myModule.service 'S', S | |
# with tap, but without setting context | |
_(angular.module('myModule', [])).tap (myModule) -> | |
myModule.value 'X', X | |
myModule.factory 'F', F | |
myModule.service 'S', S | |
# with tap and assuming that context is set to the tapped object automatically | |
_(angular.module('myModule', [])).tap -> | |
@value 'X', X | |
@factory 'F', F | |
@service 'S', S |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment