Javascript API now accepts a callback