-
Notifications
You must be signed in to change notification settings - Fork 560
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
Added AMD support #124
base: master
Are you sure you want to change the base?
Added AMD support #124
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,8 +8,16 @@ | |
* @version 2.3.7 | ||
* @requires jQuery v1.4.3+ | ||
* @preserve | ||
* @Supports AMD pattern | ||
*/ | ||
(function($) { | ||
(function($, factory){ | ||
'use strict'; | ||
if (typeof define === 'function' && define.amd) { | ||
return factory($); | ||
} else { | ||
window.jScroll = factory($); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we really like to make a global variable for jScroll? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah. To support the current singleton approach There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is not needed, because it's a jquery plugin and is therefore attached to jquery, see https://github.com/pklauzinski/jscroll/blob/master/jquery.jscroll.js#L214 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🥇 |
||
} | ||
})(jQuery || null, function($) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will do |
||
|
||
'use strict'; | ||
|
||
|
@@ -224,4 +232,6 @@ | |
}); | ||
}; | ||
|
||
})(jQuery); | ||
return jScroll; | ||
|
||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should rewrite this line to
define(['jquery'], factory);
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah