Design the JavaScript API