// where exactly is factory being passed in?
(function(factory) {
// I understand this code to be part of the
// JavaScript specification "Asynchronous Module Definition"
// and seems to be defining jQuery and moment.js as dependencies
// but they are available anyway so why do they need to be defined as dependencies here?
// where is the variable "define" coming from?
if (typeof define === 'function' && define.amd) {
define([ 'jquery', 'moment' ], factory);
}
// where is is the variable "exports" being defined
else if (typeof exports === 'object') { // Node/CommonJS
module.exports = factory(require('jquery'), require('moment'));
}
else {
factory(jQuery, moment);
}
})(function($, moment) {
// this I understand as simply defining an object "fullCalendar" in the jQuery scope
// but what does it have to do with the $.fn.fullCalendar below?
var fc = $.fullCalendar = { version: "2.4.0" };
$.fn.fullCalendar = function() {
return 'calendar test works';
};
});
$(function() {
$('#calendar').html('jquery works');
$('#calendar').fullCalendar();
});
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.