Fix IE9 missing console object

Debugging IE9 without debugging tools, when the debugging tools are
kind of the problem.  Fun.
This commit is contained in:
Matt Lott 2014-12-07 15:24:12 -08:00
parent 795e58778c
commit 343ad28761
2 changed files with 14 additions and 0 deletions

View file

@ -77,6 +77,13 @@ initializeUtilityServices = ->
require('core/services/segmentio')() require('core/services/segmentio')()
setupConsoleLogging = -> setupConsoleLogging = ->
# IE9 doesn't expose console object unless debugger tools are loaded
unless console?
window.console =
info: ->
log: ->
error: ->
debug: ->
unless console.debug unless console.debug
# Needed for IE10 and earlier # Needed for IE10 and earlier
console.debug = console.log console.debug = console.log

View file

@ -19,6 +19,13 @@ class CocoModel extends Backbone.Model
@on 'error', @onError, @ @on 'error', @onError, @
@on 'add', @onLoaded, @ @on 'add', @onLoaded, @
@saveBackup = _.debounce(@saveBackup, 500) @saveBackup = _.debounce(@saveBackup, 500)
# IE9 doesn't expose console object unless debugger tools are loaded
unless console?
window.console =
info: ->
log: ->
error: ->
debug: ->
console.debug = console.log unless console.debug # Needed for IE10 and earlier console.debug = console.log unless console.debug # Needed for IE10 and earlier
setProjection: (project) -> setProjection: (project) ->