Created
December 10, 2008 11:05
-
-
Save madrobby/34305 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var s2 = { | |
Version: '2.0.0a1' | |
}; | |
s2.fx = new (function(){ | |
var queues = [], globalQueue, heartbeat, activeEffectCount = 0; | |
this.beatOnDemand = function(dir){ | |
heartbeat[(activeEffectCount += dir) > 0 ? 'start' : 'stop'](); | |
}; | |
this.renderQueues = function(){ | |
queues.invoke('render', heartbeat.getTimestamp()); | |
}; | |
this.getQueues = function(){ | |
return queues; | |
}; | |
this.addQueue = function(queue){ | |
queues.push(queue); | |
}; | |
queues.push(globalQueue = new Scripty2.Effect.Queue()); | |
heartbeat = new Scripty2.Effect.Heartbeat(); | |
document | |
.observe('effect:heartbeat', this.renderQueues) | |
.observe('effect:queued', this.beatOnDemand.curry(1)) | |
.observe('effect:dequeued', this.beatOnDemand.curry(-1)); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment