api:js: support objects in callbacks