refine the javascript object compile JS function only once