Add JS API for programmatic use