!SLIDE center
!SLIDE bullets incremental
- Observable (gives
get
,set
,observe
) - EventEmitter (gives
fire
,prevent
,allow
) - Enumerable (gives
filter
,reduce
givenforEach
)
!SLIDE bullets incremental
class Batman.Object
$mixin @::, Batman.Observable
$mixin @::, Batman.EventEmitter
- The
@::
means "this class' prototype"
!SLIDE bullets incremental
- Batman.Object
- Batman.Set
- Batman.SetSort and Batman.SetIndex
- Batman.Hash
- Batman.Request
- Batman.StateMachine
!SLIDE bullets incremental
!SLIDE
class CoolObject extends Batman.Object
!SLIDE
class CoolObject extends Batman.Object
@accessor 'awesomeness', -> 10
!SLIDE
class CoolObject extends Batman.Object
@accessor 'awesomeness', -> 10
@observeAll 'awesomeness', (newAwesomeness) ->
!SLIDE
class CoolObject extends Batman.Object
CoolObject.accessor 'awesomeness', -> 10
CoolObject.observeAll 'awesomeness', (x) ->
!SLIDE
class CoolObject extends Batman.Object
@observe 'awesomeness', ->
!SLIDE
CoolObject.observe 'awesomeness', (x) ->
!SLIDE
!SLIDE
!SLIDE
class SomeClass extends Batman.Object
SomeClass.observe 'awesomeness', (x) ->
console.log x
SomeClass.set 'awesomeness', 10
# => "10" logged to the console