Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AMD/UMD support #86

Open
xles opened this issue Aug 21, 2013 · 2 comments
Open

AMD/UMD support #86

xles opened this issue Aug 21, 2013 · 2 comments

Comments

@xles
Copy link

xles commented Aug 21, 2013

So, in my latest project I decided to go the RequireJS route, and unfortunately Davis.js didn't have AMD support. Which is a damned shame, because I really wanted to use Davis.js.

However, I did manage to get Davis.JS loaded and working. Unfortunately I'm somewhat new to serious JavaScript development so I'm rather clueless as to where in the sources to add this stuff, so I don't have a pull request to offer... I do have a gist to offer, though, if anyone feels up to the task: https://gist.github.com/xles/6293788

I will continue to fiddle around with UMD and see if I can't get that working. If I do I'll let you know, and if I figure out what goes where in the sources I'll send a pull request (but don't hold your breath, I'm somewhat dense at times).

@olivernn
Copy link
Owner

I've not used UMD before but requirejs allows you to have 'shims' for non AMD libraries - http://requirejs.org/docs/api.html#config-shim.

In this case you could do:

requirejs.config({
    shim: {
        'davis': {
            deps: [''jquery'],
            exports: 'Davis'
        }
    }
});

@xles
Copy link
Author

xles commented Aug 21, 2013

Yeah I know, and a shim works just fine, but I wanted to load it as a native AMD module, for no good reason, really.
And UMD is basically an AMD auto-detection shim with fallback to browser globals.

I've forked the project and started fiddling around a little bit more seriously. After looking at the makefile and realising that the entire build process was a simple concatenation, I felt a bit silly leaving the previous statements up there...

You can probably expect a future pull request in a not too distant future...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants