171
edits
Petermichaux (talk | contribs) |
No edit summary |
||
| Line 5: | Line 5: | ||
## "require" returns an object containing the exported API of the foreign module. | ## "require" returns an object containing the exported API of the foreign module. | ||
## If there is a dependency cycle, the foreign module may not have finished executing at the time it is required by one of its transitive dependencies; in this case, the object returned by "require" must contain at least the exports that the foreign module has prepared before the call to require that led to the current module's execution. | ## If there is a dependency cycle, the foreign module may not have finished executing at the time it is required by one of its transitive dependencies; in this case, the object returned by "require" must contain at least the exports that the foreign module has prepared before the call to require that led to the current module's execution. | ||
## If the requested module cannot be returned, "require" must throw an error. | |||
## If the requested module cannot be returned, "require" | |||
# A module receives an "exports" object that it may add its exported API to as it executes. | # A module receives an "exports" object that it may add its exported API to as it executes. | ||
# Interoperable modules must use the exports object as the only means of exporting, since an implementation may prevent tampering with any other object shared among modules. | # Interoperable modules must use the exports object as the only means of exporting, since an implementation may prevent tampering with any other object shared among modules. | ||
edits