craftyjs.github.com

Crafty.modules

public void Crafty.modules([String repoLocation,] Object moduleMap[, Function onLoad])

modules
Map of name:version pairs for modules to load
onLoad
Callback when the modules are loaded

Browse the selection of community modules on http://craftycomponents.com

It is possible to create your own repository.

Example

// Loading from default repository
Crafty.modules({ moveto: 'DEV' }, function () {
    //module is ready
    Crafty.e("MoveTo, 2D, DOM");
});

// Loading from your own server
Crafty.modules({ 'http://mydomain.com/js/mystuff.js': 'DEV' }, function () {
    //module is ready
    Crafty.e("MoveTo, 2D, DOM");
});

// Loading from alternative repository
Crafty.modules('http://cdn.crafty-modules.com', { moveto: 'DEV' }, function () {
    //module is ready
    Crafty.e("MoveTo, 2D, DOM");
});

// Loading from the latest component website
Crafty.modules(
    'http://cdn.craftycomponents.com'
    , { MoveTo: 'release' }
    , function () {
    Crafty.e("2D, DOM, Color, MoveTo")
      .attr({x: 0, y: 0, w: 50, h: 50})
      .color("green");
    });
});