code: function( options ){
  
              var self = this;
  
              // call parent init
              parent.init.call(this, options);
  
              this.options.defaults( defaults, true );
              this.options( options, true );
  
              // init debug layer
              this.addLayer('debug', null, {
                  zIndex: 2
              });
  
              this.layer('debug').render = function(){
  
                  var intr, i, l, cols, xy;
  
                  this.el.width = this.el.width;
  
                  if ( self.options.drawIntervals && self._intervals ){
                      for ( xy = 0; xy < 2; xy++ ){
                          intr = self._intervals[ xy ];
                          for ( i = 0, l = intr.length; i < l; i++ ){
  
                              self.drawInterval( intr[ i ], this.ctx );
                          }
                      }
                  }
  
                  if ( self.options.drawContacts && self._collisions ){
                      cols = self._collisions;
                      for ( i = 0, l = cols.length; i < l; i++ ){
                          self.drawContact( cols[ i ], this.ctx );
                      }
                  }
              };
  
              if ( window.dat ){
                  this.initGui();
              }
          }
docs: extended