diff --git a/src/deprecation.js b/src/deprecation.js index d53fff5..f0e927b 100644 --- a/src/deprecation.js +++ b/src/deprecation.js @@ -9,19 +9,25 @@ // useful for tracking-down where deprecated methods/properties/classes // are being used within the code function warn(msg) { - var stack = new Error().stack; + var stack = new Error().stack; - // chop off the stack trace which includes pixi.js internal calls - stack = stack.split('\n').splice(3).join('\n'); - - if (console.groupCollapsed) { - console.groupCollapsed('%cDeprecation Warning: %c%s', 'color:#614108;background:#fffbe6', 'font-weight:normal;color:#614108;background:#fffbe6', msg); - console.warn(stack); - console.groupEnd(); + // Handle IE < 10 and Safari < 6 + if (typeof stack === 'undefined') { + console.warn('Deprecation Warning: ', msg); } else { - console.warn('Deprecation Warning: ', msg); - console.warn(stack); + // chop off the stack trace which includes pixi.js internal calls + stack = stack.split('\n').splice(3).join('\n'); + + if (console.groupCollapsed) { + console.groupCollapsed('%cDeprecation Warning: %c%s', 'color:#614108;background:#fffbe6', 'font-weight:normal;color:#614108;background:#fffbe6', msg); + console.warn(stack); + console.groupEnd(); + } + else { + console.warn('Deprecation Warning: ', msg); + console.warn(stack); + } } }