Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

is this different from the observer pattern? which languages do you program in?


I'm not aware of the observer pattern. I'm using CoffeeScript and my implementation of pub/sub is here https://gist.github.com/4489352

Sample usage:

    button =
      toggleOn: ->
        @trigger 'toggled', 'on'

    window =
      init: ->
        button.listen 'toggled', (buttonState) =>
          @showWindow if buttonState is 'on'




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: