Last active
January 3, 2016 23:39
-
-
Save zerobase/8536743 to your computer and use it in GitHub Desktop.
Chaplin/Backbone謎の擬似コード
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
class Homepage extends Chaplin.Model | |
_.extend @prototype, Chaplin.EventBroker | |
result: (val) -> | |
if val | |
publishEvent "change:result", result | |
getRemoteData: () -> | |
$.ajax () => | |
# ... | |
.done (data) => # see [fat arrow](http://coffeescript.org/#fat-arrow) | |
@result(data.[].result) | |
class HomageView extends Chaplin.View | |
constructor: (homepage) -> | |
homepage.subscribeEvent "change:result", @onChangeResult, @ | |
onChangeResult: (result) -> | |
# template <- result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment