Skip to content

Adds CommonJS/RequireJS support #56

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

Closed
wants to merge 1 commit into from
Closed

Adds CommonJS/RequireJS support #56

wants to merge 1 commit into from

Conversation

christopherjohst
Copy link

This adds support for asynchronous module definitions (AMD) through both RequireJS and CommonJS. If neither is present, the plugin is added to the global jQuery.

;(function (factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery'], factory);
} else if (typeof exports === 'object') {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not very familiar with requireJS, so I may be way off base here, but should this not be

else if (typeof module === 'object' && module && module.exports) {

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nvm. seems both would work based on this: https://github.com/substack/browserify-handbook#exports

scdoshi added a commit that referenced this pull request Jun 14, 2015
scdoshi added a commit that referenced this pull request Jun 14, 2015
@scdoshi
Copy link
Owner

scdoshi commented Jun 14, 2015

will be covered in v2.0: #57

@scdoshi scdoshi closed this Jun 14, 2015
@christopherjohst
Copy link
Author

Just saw this, yes they both do the same thing. module.exports is commonJS syntax though, define is for requireJS.

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

Successfully merging this pull request may close these issues.

2 participants