Last active
August 29, 2015 13:56
-
-
Save DrSammyD/9082613 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define(function () { | |
return requirejs.config({ | |
paths: { | |
'text': './text', | |
'modernizr': './modernizr-2.6.2', | |
'jquery': './jquery-1.11.0', | |
'jquery-ui': './jquery-ui-1.10.3', | |
'jquery-unobtrusive': "./jquery.unobtrusive-ajax", | |
'jquery-val': "./jquery.validate", | |
'knockout': './knockout-3.0.0.debug', | |
'lodash': './lodash', | |
'bootstrap': './bootstrap', | |
'bootbox': './bootbox', | |
'gridmvc': './gridmvc', | |
'common': './common', | |
'regular': './app/js', | |
'coffee': './app/cs', | |
'ko-mapping': 'knockout.mapping-latest.debug', | |
'resolveRelink':'lodash.resolveRelink', | |
'main': './app/js/main', | |
'modal': './app/js/modalViewModel', | |
'reportSummaryClass': './app/js/Patients/reportSummaryClass', | |
'shortcut':'./shortcut' | |
}, | |
map: { | |
'*': { | |
'jquery': 'jquery-private', | |
'modernizr': 'modernizr-private' | |
}, | |
'modernizr-private': { 'modernizr': 'modernizr' }, | |
'jquery-private': { 'jquery': 'jquery' }, | |
'bootstrap': { 'jquery': 'jquery' } | |
}, | |
shim: { | |
'jquery': { exports: "jQuery" }, | |
'bootstrap': { deps: ['jquery'] }, | |
'modernizr': { exports: 'Modernizr' }, | |
'knockout': { deps: ['jquery'] }, | |
'jquery-ui': ['jquery'], | |
'jquery-unobtrusive': ['jquery'], | |
'gridmvc': ['jquery', 'jquery-unobtrusive'], | |
'bootbox': ['jquery'], | |
'ko-mapping': ['knockout'] | |
} | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define('modernizr-private', ['modernizr'], function(md) { return md; }); | |
define('jquery-private', ['jquery'], function (jq) { | |
return jq.noConflict(true); | |
}); | |
define('main', function (_) { | |
return function (refpath, scriptspath) { | |
var viewInit = function () { | |
var args = arguments; | |
requirejs.config({ | |
baseUrl: scriptspath | |
}); | |
requirejs([refpath], function () { | |
viewInit.startup.apply(this, args); | |
}); | |
}; | |
viewInit.startup = function () { | |
var args = arguments; | |
requirejs(['lodash', 'modernizr','customBindings','resolveRelink','text.export','knockout-repeat','bootstrap'], function(_) { | |
var stringify = JSON.stringify; | |
var opt = {clone:false}; | |
JSON.stringify= function(obj){ | |
return stringify(_.resolve(obj)); | |
}; | |
var parse = JSON.parse; | |
JSON.parse= function(str){ | |
return _.relink(parse(str,opt)); | |
}; | |
requirejs.apply(this, args); | |
}); | |
}; | |
return viewInit; | |
}; | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="/Scripts/require.js" data-main="/Scripts/app/js/main.js"></script> | |
<script> | |
define('viewInit', ['main'], function (setup) { | |
return setup('/Scripts/ref.js', '/Scripts'); | |
}); | |
var requireOrig = require; | |
require = function () { | |
var args = arguments; | |
return requireOrig(['viewInit'], function (init) { | |
init.apply(this, args); | |
setTimeout(function () { require = requireOrig; }, 10); | |
}); | |
}; | |
define('viewData', ['lodash'], function (_) { | |
var model = _({}); | |
// Activates knockout.js | |
return model.relink({ clone: false }).value(); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment