Error while using listeners in tile_map.js

I am trying to sync my old codebase of kibana (4.0.1)to incroporate new ones. While trying to use listeners in tile_map.js (plugins\vis_types\vislib\tile_map.js) to integrate autoprecision I get the follwing error:

The code which I am trying to integrate is as follows:
I know its bit of long shot to ask here, but got stuck here since a few days


It looks like Handler.enable is expecting a chart to be passed in as the second argument and it isn't defined. It may be worth diffing Handler.enable with what it is in master, where if chart isn't defined it grabs this.charts or setting a breakpoint here and checking if/why chart is undefined.