figured out how to communicate js and c++ with js callbacks. phew!!!