You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
RequireJS allows some syntatic sugar so that instead of passing an array of dependencies, then declaring names for those dependencies in the factory in (hopefully) the correct order, you just class require, and then can use more familiar (to CommonJS people) require() calls:
define(function(require){var$=require('jquery')varutilities=require('../app/utilities')// insert magic words here that make browser do things})
To do this in a UMD friendly way, I think you'd do something like this:
(function(root,factory){if(typeofdefine==='function'&&define.amd){define(factory)}else{// Browserroot.returnExports=factory()}}(this,function(require){if(typeofrequire==='function'&&define.amd){var$=require('jquery')}// insert more magic words herereturn{}}));
I don't know how prevalent this type is, but I find it much easier to write and read. Maybe this example could be covered?
The text was updated successfully, but these errors were encountered:
RequireJS allows some syntatic sugar so that instead of passing an array of dependencies, then declaring names for those dependencies in the factory in (hopefully) the correct order, you just class
require
, and then can use more familiar (to CommonJS people)require()
calls:To do this in a UMD friendly way, I think you'd do something like this:
I don't know how prevalent this type is, but I find it much easier to write and read. Maybe this example could be covered?
The text was updated successfully, but these errors were encountered: