File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -313,7 +313,18 @@ cc._initDebugSetting = function (mode) {
313
313
//log to console
314
314
315
315
cc . error = Function . prototype . bind . call ( console . error , console ) ;
316
- cc . assert = Function . prototype . bind . call ( console . assert , console ) ;
316
+ //If console.assert is not support user throw Error msg on wrong condition
317
+ if ( console . assert ) {
318
+ cc . assert = Function . prototype . bind . call ( console . assert , console ) ;
319
+ } else {
320
+ cc . assert = function ( cond , msg ) {
321
+ if ( ! cond && msg ) {
322
+ for ( var i = 2 ; i < arguments . length ; i ++ )
323
+ msg = msg . replace ( / ( % s ) | ( % d ) / , cc . _formatString ( arguments [ i ] ) ) ;
324
+ throw new Error ( msg ) ;
325
+ }
326
+ } ;
327
+ }
317
328
if ( mode !== ccGame . DEBUG_MODE_ERROR )
318
329
cc . warn = Function . prototype . bind . call ( console . warn , console ) ;
319
330
if ( mode === ccGame . DEBUG_MODE_INFO )
You can’t perform that action at this time.
0 commit comments