Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects, and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Developer articles
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
omygithub
AutoJs-Docs
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
AutoJs-Docs
/
json
/
modules.json
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
14 lines (14 loc) · 1.81 KB
master
Breadcrumbs
AutoJs-Docs
/
json
/
modules.json
Copy path
Top
File metadata and controls
Code
Blame
14 lines (14 loc) · 1.81 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{
"source"
:
"
..
\\
api
\\
modules.md
"
,
"modules"
: [
{
"textRaw"
:
"
module (模块)
"
,
"name"
:
"
module_(模块)
"
,
"stability"
:
2
,
"stabilityText"
:
"
Stable
"
,
"desc": "<p>Auto.js 有一个简单的模块加载系统。 在 Auto.js 中,文件和模块是一一对应的(每个文件被视为一个独立的模块)。</p>\n<p>例子,假设有一个名为 foo.js 的文件:</p>\n<pre><code>var circle = require('circle.js');\nconsole.log("半径为 4 的圆的面积是 %d", circle.area(4));\n</code></pre><p>在第一行中,foo.js 加载了同一目录下的 circle.js 模块。</p>\n<p>circle.js 文件的内容为:</p>\n<pre><code>const PI = Math.PI;\n\nvar circle = {};\n\ncircle.area = function (r) {\n return PI * r * r;\n};\n\ncircle.circumference = (r) => 2 * PI * r;\n\nmodule.exports = circle;\n</code></pre><p>circle.js 模块导出了 area() 和 circumference() 两个函数。 通过在特殊的 exports 对象上指定额外的属性,函数和对象可以被添加到模块的根部。</p>\n<p>模块内的本地变量是私有的。 在这个例子中,变量 PI 是 circle.js 私有的,不会影响到加载他的脚本的变量环境。</p>\n<p>module.exports属性可以被赋予一个新的值(例如函数或对象)。</p>\n<p>如下,bar.js 会用到 square 模块,square 导出一个构造函数:</p>\n<pre><code>const square = require('square.js');\nconst mySquare = square(2);\nconsole.log("正方形的面积是 %d", mySquare.area());\nsquare 模块定义在 square.js 中:\n\n// 赋值给 `exports` 不会修改模块,必须使用 `module.exports`\nmodule.exports = function(width) {\n return {\n area: () => width ** 2\n };\n};\n</code></pre>",
"type"
:
"
module
"
,
"displayName"
:
"
module (模块)
"
}
]
}
You can’t perform that action at this time.