Skip to content

Instantly share code, notes, and snippets.

@steveruizok
Last active May 11, 2018 22:08
Show Gist options
  • Save steveruizok/ed82fb14de349a47ea40f614b7d1e661 to your computer and use it in GitHub Desktop.
Save steveruizok/ed82fb14de349a47ea40f614b7d1e661 to your computer and use it in GitHub Desktop.
class MyClass extends Layer
constructor: (options = {}) ->
super options
@_isRightEnough = @x > 200
@onIsRightEnough = -> null
@on "change:x", ->
isRightEnough = @x > 200
return if isRightEnough is @_isRightEnough
@_isRightEnough = isRightEnough
@emit "change:isRightEnough", @_isRightEnough, @
@onIsRightEnough(@_isRightEnough)
myInstance = new MyClass
myInstance.onIsRightEnough = (bool) -> print bool
myInstance.draggable.enabled = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment