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) {
|
module.exports = function(root, renderer, pubsub, callback) {
|
||||||
var run = throttle(callback)
|
var run = throttle(callback)
|
||||||
renderer.setEventCallback(function(e) {
|
if (renderer != null) {
|
||||||
if (e.redraw !== false) run()
|
renderer.setEventCallback(function(e) {
|
||||||
})
|
if (e.redraw !== false) run()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
if (pubsub != null) {
|
if (pubsub != null) {
|
||||||
if (root.redraw) pubsub.unsubscribe(root.redraw)
|
if (root.redraw) pubsub.unsubscribe(root.redraw)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue