make renderer optional in autoredraw module
This commit is contained in:
parent
9b602edf4e
commit
6400b616fc
1 changed files with 5 additions and 3 deletions
|
|
@ -4,9 +4,11 @@ var throttle = require("../api/throttle")
|
|||
|
||||
module.exports = function(root, renderer, pubsub, callback) {
|
||||
var run = throttle(callback)
|
||||
renderer.setEventCallback(function(e) {
|
||||
if (e.redraw !== false) run()
|
||||
})
|
||||
if (renderer != null) {
|
||||
renderer.setEventCallback(function(e) {
|
||||
if (e.redraw !== false) run()
|
||||
})
|
||||
}
|
||||
|
||||
if (pubsub != null) {
|
||||
if (root.redraw) pubsub.unsubscribe(root.redraw)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue