Forum Discussion
_anomDiebolt_
8 years agoQrew Elite
This took less time than I thought. I tested it and adding the two comments fixed the problem. Here is the console session and a screenshot:
Actually I am very glad you asked this question. I know a lot of people have attempted to load libraries and been turned off on using script because of this problem. Even if you know what the problem is it can still be tricky as many library authors do not unambiguously announce how their libraries are to be loaded (many authors smuggly assume AMD or CommonJS and ignore conventional global loading) and use their own weird module loading logic (the UMD pattern is far from being universally adopted)
$.getScript("https://haversineconsulting.quickbase.com/db/bmrpn5xrr?a=dbpage&pagename=moment.js",functio... {var now = moment();
console.log(now);
});
Uncaught ReferenceError: moment is not defined
at Object.success (<anonymous>:2:15)
at o (jquery-1.7.2.min.js:2)
at Object.fireWith [as resolveWith] (jquery-1.7.2.min.js:2)
at w (jquery-1.7.2.min.js:4)
at XMLHttpRequest.d (jquery-1.7.2.min.js:4)
$.getScript("https://haversineconsulting.quickbase.com/db/bmrpn5xrr?a=dbpage&pagename=momentMODIFIED.js"... {
var now = moment();
console.log(now);
});
Object {readyState: 1, setRequestHeader: function, getAllResponseHeaders: function, getResponseHeader: function, overrideMimeType: function...}
Moment {_isAMomentObject: true, _isUTC: false, _pf: Object, _locale: Locale, _d: Fri May 05 2017 19:14:33 GMT-0400 (Eastern Daylight Time)...}
Actually I am very glad you asked this question. I know a lot of people have attempted to load libraries and been turned off on using script because of this problem. Even if you know what the problem is it can still be tricky as many library authors do not unambiguously announce how their libraries are to be loaded (many authors smuggly assume AMD or CommonJS and ignore conventional global loading) and use their own weird module loading logic (the UMD pattern is far from being universally adopted)
ArchiveUser
8 years agoQrew Captain
Ah, you beat me to the test. This is the first library I've had an issue loading. I use underscore quite frequently with no issues, so I was thrown as to why this one was a problem. Thanks for shedding the light! Really, really appreciate the help and insight.