How to access jQuery plugin added through libraries API I'm working on a Drupal 7 module to integrate an existing jQuery plugin (smallworld.js). I've added it successfully through the Libraries 2.x API in my module: 

$libraries['smallworld.js'] = array(
    'name' =&gt; 'SmallWorld.js',
    'vendor url' =&gt; 'http://mikefowler.me/smallworld.js/',
    'download url' =&gt; 'https://github.com/mikefowler/smallworld.js',
    'version' =&gt; '1.0', //no version actually defined in code
    'files' =&gt; array(
      'js' =&gt; array('src/smallworld.js'),
      'js' =&gt; array('src/smallworld.jquery.js'),
    ),
  );


and have confirmed that the files are loading correctly. However, when I try and access the file in my Drupal jQuery, ex: 

(function ($) {

  Drupal.behaviors.smallworld = {
    attach: function (context, settings) {
      $.getJSON('/sites/all/libraries/smallworld.js/dist/world.json', function (data) {
        $('.map').smallworld({
          geojson: data,
        });
      });
    }
  };
}(jQuery));


It doesn't trigger, giving me the console error message "Smallworld is not a constructer."

The two files it is loading are the Smallworld library and a smaller jquery wrapper that registers the library as a jquery plugin:

  $.extend($.fn, {
    smallworld: function (options) {
      var opts = $.extend({}, $.fn.smallworld.defaults, options);
      return this.each(function () {
        $(this).data('smallworld', new Smallworld(this, opts));
        return this;
      });
    }
  });


Does this wrapper also needed to be added to the same Drupal jquery namespace? If a jquery library is added through Libraries API, is there special namespacing to consider when accessing it?
Found the problem - this library comes with two separate files, one that is a straightup javascript library and another in jquery that registers the file as a plugin (smallworld.jquery.js)

  $.extend($.fn, {
    smallworld: function (options) {
      var opts = $.extend({}, $.fn.smallworld.defaults, options);
      return this.each(function () {

      $(this).data('smallworld', new Smallworld(this, opts));
      return this;
    });


To get this to work, I had to take the whole 'register' script and add it to the jquery file script I created for the module, ex:

(function ($) {

  Drupal.behaviors.smallworld = {
    attach: function (context, settings) { ...