implemented garbage collection for java script objects using tonyrog/resource.git