Skip to content

Instantly share code, notes, and snippets.

@mrvisser
Created February 13, 2013 19:55
Show Gist options
  • Save mrvisser/4947618 to your computer and use it in GitHub Desktop.
Save mrvisser/4947618 to your computer and use it in GitHub Desktop.
// When jquery is concated into oae.core, I get the output with the following code:
// MyModule.js
define(['jquery', 'oae.core', 'jquery.timeago', 'jquery.infinitescroll'], function($, oae, timeago, infiniteScroll) {
return function(uid, showSettings, widgetData) {
/////////////////////////////
// Configuration variables //
/////////////////////////////
var $rootel = $('#' + uid);
var infinityScroll = false;
console.log('Local $.timeago: ' + $.timeago);
console.log('Global jQuery.timeago: ' + jQuery.timeago);
...
});
// Timeago:
define(['jquery'], function (jQuery) {
(function($) {
$.timeago = function(timestamp) {
if (timestamp instanceof Date) return inWords(timestamp);
else if (typeof timestamp == "string") return inWords($.timeago.parse(timestamp));
else return inWords($.timeago.datetime(timestamp));
};
...
//Output:
Local $.timeago: function (timestamp) {
if (timestamp instanceof Date) return inWords(timestamp);
else if (typeof timestamp == "string") return inWords($.timeago.parse(timestamp));
else return inWords($.timeago.datetime(timestamp));
} activity.js:31
Global jQuery.timeago: undefined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment