Javascript Drupal Extension extends the Drupal JavaScript object by exposing Drupal/PHP functions via AJAX-calls.
Ever needed to call a Drupal function from JavaScript that isn't already available in the Drupal JavaScript object? Javascript Drupal Extension fixes that by extending the Drupal object to expose PHP functions via AJAX-calls.
By default this module includes drupal_get_path() as it was the reason I made the module in the first place. I needed to get the path of a module that was installed, and thus Javascript Drupal Extension was born.
Example:
var path = Drupal.drupal_get_path('module', 'my-awesome-module');
-or-
Drupal.drupal_get_path('module', 'my-awesome-module', 'callback-function-for-path');
Both these queues up the AJAX call, which by default is filtered through a whitelist to ensure safety, and either returns the output of the called function directly, or sends the output to the callback function supplied as the last argument. You can also supply another callback after the first one which will be used in case the AJAX-call fails for some reason. The default action in that case is to throw an error.
Extending:
The module is written in such a way that extending other functions is as easy as adding a few lines of codes.