Permalink
Browse files

Add context events

  • Loading branch information...
koenbok committed Oct 27, 2014
1 parent ecfa572 commit 6c287fe4787330085d1c5d9b6a38525a5036d2df
Showing with 14 additions and 2 deletions.
  1. +7 −2 framer/Context.coffee
  2. +6 −0 framer/Layer.coffee
  3. +1 −0 test/init.coffee
@@ -3,12 +3,15 @@ Utils = require "./Utils"
{_} = require "./Underscore"
{Config} = require "./Config"
{EventManager} = require "./EventManager"
{EventEmitter} = require "./EventEmitter"
Counter = 1
class exports.Context
class exports.Context extends EventEmitter
constructor: (options={}) ->
super
Counter++
@@ -43,7 +46,9 @@ class exports.Context
@_layerList = []
@_animationList = []
@_delayTimers = []
@_delayIntervals = []
@_delayIntervals = []
@emit("reset", @)
getRootElement: ->
@_rootElement
@@ -79,6 +79,8 @@ class exports.Layer extends BaseClass
# Add this layer to the current context
@_context._layerList.push(@)
@_id = @_context._layerList.length
# Keep track of the default values
# @_defaultValues = options._defaultValues
@@ -98,6 +100,8 @@ class exports.Layer extends BaseClass
# Set needed private variables
@_subLayers = []
@_context.emit("layer:create", @)
##############################################################
# Properties
@@ -445,6 +449,8 @@ class exports.Layer extends BaseClass
@_context._layerList = _.without @_context._layerList, @
@_context.emit("layer:destroy", @)
##############################################################
## COPYING
@@ -24,4 +24,5 @@ require "./tests/VideoLayerTest"
require "./tests/CompatTest"
require "./tests/ImporterTest"
require "./tests/LayerAnimationTest"
require "./tests/ContextTest"

0 comments on commit 6c287fe

Please sign in to comment.