bebraw
3/27/2011 - 1:36 PM

RequireJS plugin definition

RequireJS plugin definition

define(['./plugins'], function(plugins) {
    // this should just hook things up (iterate plugins, attach functionality as needed ie.)
    // the actual app uses this to access the plugins, construct UI and so on
});
define(['./foo', './bar', './baz'],
        function(foo, bar, baz) {
    return {
        foo: foo,
        bar: bar,
        baz: baz
    };
});
// example of a plugin
define({
    meta: {
        tooltip: 'Just some tool to foo some shiz'
    },
    selected: function() {...},
    deselected: function() {...}
});