javascript loader implementation