(id, deps, factory)
| 13576 | |
| 13577 | //Create a define function specific to the module asking for amdefine. |
| 13578 | function define(id, deps, factory) { |
| 13579 | if (Array.isArray(id)) { |
| 13580 | factory = deps |
| 13581 | deps = id |
| 13582 | id = undefined |
| 13583 | } else if (typeof id !== "string") { |
| 13584 | factory = id |
| 13585 | id = deps = undefined |
| 13586 | } |
| 13587 | |
| 13588 | if (deps && !Array.isArray(deps)) { |
| 13589 | factory = deps |
| 13590 | deps = undefined |
| 13591 | } |
| 13592 | |
| 13593 | if (!deps) { |
| 13594 | deps = ["require", "exports", "module"] |
| 13595 | } |
| 13596 | |
| 13597 | //Set up properties for this module. If an ID, then use |
| 13598 | //internal cache. If no ID, then use the external variables |
| 13599 | //for this node module. |
| 13600 | if (id) { |
| 13601 | //Put the module in deep freeze until there is a |
| 13602 | //require call for it. |
| 13603 | defineCache[id] = [id, deps, factory] |
| 13604 | } else { |
| 13605 | runFactory(id, deps, factory) |
| 13606 | } |
| 13607 | } |
| 13608 | |
| 13609 | //define.require, which has access to all the values in the |
| 13610 | //cache. Useful for AMD modules that all have IDs in the file, |
no test coverage detected
searching dependent graphs…