amdjs / amdjs-api

Houses the Asynchronous Module Definition API
https://groups.google.com/group/amd-implement
4.3k stars 499 forks source link

Methods of requirejs #22

Open nick4fake opened 10 years ago

nick4fake commented 10 years ago

I think it would be great to standardize some methods of RequireJS. For example, require.defined gives bool (if module was already loaded), and I don't think this is too specific to include it into AMD.

jrburke commented 10 years ago

I think it would be better to standardize on the names proposed by the ES6 module loader. In the given example, I believe it is a .has() name. At least that is the plan I am hoping to take. But, I think we need to do a bit more implementation trials to make sure the ES6 names and behavior make sense.

In this particular case though, I would be happy to implement a .has (which would just be an alias for .defined in requirejs) if the other loader implementers wanted to start with that one, as I think it is fairly straightforward. If that ID already has an export in the module table, then return true.

jakobo commented 10 years ago

Just coming back to the AMD mailing list thread at https://groups.google.com/forum/#!searchin/amd-implement/defined/amd-implement/oYXr9XmgayY/u-8MVi4bRxgJ

There was some original concern around exposing the registry of defined modules as part of the public interface. Have these issues been resolved?