javascript: Common API generation