code: function(evt) {
          var layer = evt.layer;
          if (layer instanceof OpenLayers.Layer.Grid) {
              layer.events.on({
                  addtile: this.addTile,
                  retile: this.clearTileQueue,
                  scope: this
              });
              var i, j, tile;
              for (i=layer.grid.length-1; i>=0; --i) {
                  for (j=layer.grid[i].length-1; j>=0; --j) {
                      tile = layer.grid[i][j];
                      this.addTile({tile: tile});
                      if (tile.url && !tile.imgDiv) {
                          this.manageTileCache({object: tile});
                      }
                  }
              }
          }
      }
docs: Method: addLayer
  Handles the map's addlayer event
  
  Parameters:
  evt - {Object} The listener argument