implementing native callback into JS