Form API, drupal_add_js() and setting a JS variable Consider

drupal_add_js(array(
  'radio86_media' =&gt; array('barfoo' =&gt; 'booboo')), 'setting'
);    


and

$form['#attached']['js'] = array(
  drupal_get_path('module', 'radio86_media') . '/select_media.js', 
);    


These two 'lines' work well separately, but I think they could (and should) be combined so that the variable setting is set on the second line, combining the logic. 

I've been fumbling around it and just can't get it to work. With this current way, I can console.log the barfoo variable via JS by using Drupal.settings.radio86_media.barfoo so it does work, but I really would like to have it combined.

Any suggestions greatly appreciated!
I never tried, but I guess you can do it like that : 

$form['#attached']['js'] = array(
  array(
    'data' =&gt; drupal_get_path('module', 'radio86_media') . '/select_media.js',
    'type' =&gt; 'file'
  ),
  array(
    'data' =&gt; array('radio86_media' =&gt; array('barfoo' =&gt; 'booboo')),
    'type' =&gt; 'setting'
  )
);


According the documentation you should be able to add settings and files.