cowboy/jquery-hashchange

Using Requirejs

peduarte opened this issue · 1 comments

Has anyone used this with Requirejs?
I am struggling to get it to work.

This is what I have at the moment:

var require = {
    enforceDefine: true,
    paths: {
        'jquery': '/js/vendor/jquery.min',
        'hashchange': '/js/vendor/jquery.hashchange.plugin',
    },
    shim: {
        'jquery': {
            exports: '$'
        }
        'hashchange': {
            deps: ['jquery'],
            exports: 'Hashchange'
        }
    }
};

And this is how I define it later on:

define(['jquery', 'hashchange'], function ($, Hashchange) {
    // code
});

Any tips will be very appreciated,
Thanks!

Got it to work... problem was with the exports option in the shim: {};

'hashchange': {
    deps: ['jquery'],
    exports: 'jQuery.fn.hashchange.'
}