add optional callback

callback function called when rendering is finished; passed as a 3rd optional parameter on render method