I have the following in my js file that is called by requirejs
define([
'jquery',
'backbone',
'mobiledetect'
],
function($, Backbone, mobiledetect) {
var MobileCheckView = Backbone.View.extend({
initialize: function(){
var md = new MobileDetect(window.navigator.userAgent);
if (md.mobile() || md.phone() || md.tablet()) {
$('#mho_app').popup('show');
}
}
});
return MobileCheckView;
});
I get Uncaught ReferenceError: MobileDetect is not defined when referencing the external file via path in my main.js file
I have tried defining it directly at the top of the file as well with no luck. What am I missing that's keeping the script from loading and giving me the object?
define('mobiledetect', ['https://cdnjs.cloudflare.com/ajax/libs/mobile-detect/1.3.6/mobile-detect.min.js'], function () {
var md = new MobileDetect(window.navigator.userAgent);
return md;
});