Open dcsan opened 9 years ago
oh yeah also i really prefer coffeescript to plain JS... we can mix and match tho.
@dcsan yeah, for my personal projects I mostly used CoffeeScript, too. As all famo.us stuff was plain JS, I go with it. But in CoffeeScript I think it could look something like this:
class StoryOneView extends View
@DEFAULT_OPTIONS:
transition:
duration: 300
curve: Easing.outBack
constructor: (@options)->
super @options
@_modifiers = []
@_states = []
_createMain: () ->
that looks nice and clean!
i ended up doing this below so i can pass in the background to the scrollview for piping events around so you can click in the background to scroll too.
@StoryListView = ->
View.apply this, arguments
sc = _createScrollView.call this
_createBack(this, sc)
return
I'm still getting to know famous, so when things are passed around always as "this" using syntax like:
I find it a bit hard to follow what is what - lots of implicit objects are being passed around.
I know this is how famous has structured a lot of their code but it takes time to parse for me at least.
this may potentially lose some flexibility in abstraction but it makes things clearer. in future if we ever did switch to using typescript or something to check parameters it could be helpful too.