Just look through the Drupal source code of modules/system/ or something similar that implements drupal_add_js().