Community
Participate
Working Groups
The global.js file has a minimal window.define function for the cases when requirejs is not used, and that's perfect for integrators which do not deal with the usual case of web-based loading of the scripts. (like our case at Mozilla). We would also like a minimal window.require function so we don't have to integrate the whole requirejs. Will submit a patch. Thank you!
Proposed patch: https://github.com/mihaisucan/orion.client/tree/bug-364214 Please review the patch and let me know if further changes are needed. Thank you very much! (This makes it easier for us to integrate Orion. Otherwise we'll have to include requirejs, which is overly complex for what we need.)
it looks fine to me. We didn't add window.require because we did not need it. Will you actually be using this method or are you adding it for consistency sake ?
(In reply to comment #2) > it looks fine to me. Great! > We didn't add window.require because we did not need it. Will you actually be > using this method or are you adding it for consistency sake ? We are actually going to use it.
Note that our current implementation for define is as follow: window.define = function(deps, callback, moduleName) The actual signature for define is: window.define = function(moduleName, deps, callback) The problem of using the actual signature is that it would force all user to pass the optional moduleName to define, which has the problem described in http://requirejs.org/docs/api.html#modulename "You can explicitly name modules yourself, but it makes the modules less portable -- if you move the file to another directory you will need to change the name. It is normally best to avoid coding in a name for the module..." thoughts ?
(In reply to comment #4) > Note that our current implementation for define is as follow: > window.define = function(deps, callback, moduleName) > > The actual signature for define is: > window.define = function(moduleName, deps, callback) > > The problem of using the actual signature is that it would force all user to > pass the optional moduleName to define, which has the problem described in > http://requirejs.org/docs/api.html#modulename > "You can explicitly name modules yourself, but it makes the modules less > portable -- if you move the file to another directory you will need to change > the name. It is normally best to avoid coding in a name for the module..." > > thoughts ? Well, the current Orion code uses deps, callback, moduleName, and it works with the current window.define implementation from global.js. We don't have any specific needs/requirements for making window.define compatible with the actual requirejs API, as long as the Orion code can be used with the define() and require() shims from global.js. That's what matters for us. Thanks!
Given Felipe gave his OK for the new window.require method I have landed the patch. http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=bccd9ec7b7eacf87d27015a9d78af4f0cfa29487 I hope this is fine with you. Thank you very much!
> I hope this is fine with you. Thank you very much! Yes, thank you.