"Hello Dojo!" 教程中 require() 的第二个参数触发执行的原因

What triggers execution of the second parameter to require() in the "Hello Dojo!" tutorial

我正在学习 "Hello Dojo!" 教程,发现 here

本教程的主要逻辑是传递给 header 中的 require() 调用的函数,但我不知道是什么触发了它:

<!DOCTYPE html>
<html>
<head>
 <meta charset="utf-8">
 <title>Tutorial: Hello Dojo!</title>
</head>
<body>
 <h1 id ="greeting">Hello</h1>
 <!-- load Dojo -->
 <script src="http://ajax.googleapis.com/ajax/libs/dojo/1.10.4/dojo/dojo.js" 
  data-dojo-config="async: true"></script>
  
 <script>
<!-- how is this calling!? --> 
  require([
   'dojo/dom',
   'dojo/dom-construct'
  ], function(dom,domConstruct) {
   var greetingNode = dom.byId('greeting');
   domConstruct.place('<em> Dojo!</em>', greetingNode);
   })
 </script>
</body>
</html>

我了解 within 该函数的调用逻辑 - 获取对 greeting 元素的引用,然后向其附加 em 节点 -但我无法弄清楚why/how函数中的代码是从哪里开始执行的!

您有:require(...)

所以你调用 require 并传递一个字符串数组和一个函数作为参数。

require(或者它稍后调用的函数)负责调用第二个参数。