MCPcopy
hub / github.com/mobxjs/mobx / define

Function define

docs/assets/getting-started-assets/javascripts/JSXTransformer.js:13578–13607  ·  view source on GitHub ↗
(id, deps, factory)

Source from the content-addressed store, hash-verified

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,

Callers 8

babel.min.jsFile · 0.85
mobx-react.jsFile · 0.85
mobx.umd.jsFile · 0.85
JSXTransformer.jsFile · 0.85
codemirror.jsFile · 0.85
javascript.jsFile · 0.85

Calls 1

runFactoryFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…