Skip to content

Instantly share code, notes, and snippets.

@zerobase
Last active January 3, 2016 23:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zerobase/8536743 to your computer and use it in GitHub Desktop.
Save zerobase/8536743 to your computer and use it in GitHub Desktop.
Chaplin/Backbone謎の擬似コード
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