JavaScript Implementation of the API