Permalink
Browse files

Adde reset to state machine

  • Loading branch information...
nvh committed Jul 26, 2016
1 parent 3d868d0 commit 7179178a0545959f6771ce57b26d838597d2ba27
Showing with 6 additions and 3 deletions.
  1. +6 −3 framer/LayerStateMachine.coffee
@@ -9,11 +9,9 @@
class exports.LayerStateMachine extends BaseClass
constructor: (layer) ->
super
- @_previousNames = []
@_layer = layer
- @currentName = 'initial'
@initial = LayerStates.filterStateProperties(layer.props)
- @states = new LayerStates(@)
+ @reset()
@define "current",
get: -> @states[@currentName]
@@ -41,6 +39,11 @@ class exports.LayerStateMachine extends BaseClass
states = @stateNames
Utils.arrayNext(states, @currentName)
+ reset: ->
+ @states = new LayerStates(@)
+ @_previousNames = []
+ @currentName = 'initial'
+
emit: (args...) ->
super
# Also emit this to the layer with self as argument

0 comments on commit 7179178

Please sign in to comment.