Skip to content
This repository has been archived by the owner on Jan 12, 2018. It is now read-only.

Commit

Permalink
Make gc more readable by extracting hasListeners property
Browse files Browse the repository at this point in the history
  • Loading branch information
Kim Burgestrand committed Sep 25, 2013
1 parent 0d14c20 commit 5dc545b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/property.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,14 @@ class PropertyAccessor
for dependency in @definition.localDependencies
@object[dependency + "_property"]?.registerGlobal()

def @prototype, "hasListeners", get: ->
@listeners.length is 0 and not @dependentProperties.find((prop) => prop.listeners.length isnt 0)

gc: ->
if @listeners.length is 0 and not @dependentProperties.find((prop) => prop.listeners.length isnt 0)
if @hasListeners
fn() for fn in @_gcQueue
@_isRegistered = false
@_gcQueue = []

for dependency in @definition.localDependencies
@object[dependency + "_property"]?.gc()
Expand Down

0 comments on commit 5dc545b

Please sign in to comment.