diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/mozilla/javascript_code_modules/geometry.jsm | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/mozilla/javascript_code_modules/geometry.jsm')
-rw-r--r-- | files/zh-cn/mozilla/javascript_code_modules/geometry.jsm/index.html | 19 | ||||
-rw-r--r-- | files/zh-cn/mozilla/javascript_code_modules/geometry.jsm/services.jsm/index.html | 25 |
2 files changed, 44 insertions, 0 deletions
diff --git a/files/zh-cn/mozilla/javascript_code_modules/geometry.jsm/index.html b/files/zh-cn/mozilla/javascript_code_modules/geometry.jsm/index.html new file mode 100644 index 0000000000..bc18819d7a --- /dev/null +++ b/files/zh-cn/mozilla/javascript_code_modules/geometry.jsm/index.html @@ -0,0 +1,19 @@ +--- +title: Geometry.jsm +slug: Mozilla/JavaScript_code_modules/Geometry.jsm +translation_of: Mozilla/JavaScript_code_modules/Geometry.jsm +--- +<p>{{ gecko_minversion_header("2.0") }}</p> +<p>The <code>Geometry.jsm</code> JavaScript code module provides routines for performing common geometry operations on points and rectangles. It exports two classes: <code>Point</code> and <code>Rect</code>.</p> +<p>To use these routines, you first need to import the code module into your JavaScript scope:</p> +<pre class="eval"><span class="nowiki">Components.utils.import("resource://gre/modules/Geometry.jsm");</span> +</pre> +<p>Once you've imported the module, you can then use the <a href="/zh-CN/JavaScript_code_modules/Geometry.jsm/Point" title="zh-CN/JavaScript code modules/Geometry.jsm/Point"><code>Point</code></a> and <a href="/zh-CN/JavaScript_code_modules/Geometry.jsm/Rect" title="https://developer.mozilla.org/zh-CN/JavaScript_code_modules/Geometry.jsm/Rect"><code>Rect</code></a> classes.</p> +<div class="note"> + <strong>Note:</strong> Although this module is usable from mobile, and is present in Firefox 4, it's currently not used in Firefox 4 and attempting to use it may produce unreliable results there.</div> +<h2 id="See_also">See also</h2> +<ul> + <li><a class="internal" href="/zh-CN/JavaScript_code_modules/Using" title="zh-CN/JavaScript code modules/Using JavaScript code modules">Using JavaScript code modules</a></li> + <li><a class="internal" href="/zh-CN/JavaScript_code_modules" title="zh-CN/JavaScript code modules">JavaScript code modules</a></li> + <li><a class="internal" href="/zh-CN/Components.utils.import" title="zh-CN/Components.utils.import"><code>Components.utils.import</code></a></li> +</ul> diff --git a/files/zh-cn/mozilla/javascript_code_modules/geometry.jsm/services.jsm/index.html b/files/zh-cn/mozilla/javascript_code_modules/geometry.jsm/services.jsm/index.html new file mode 100644 index 0000000000..1acdc77cdf --- /dev/null +++ b/files/zh-cn/mozilla/javascript_code_modules/geometry.jsm/services.jsm/index.html @@ -0,0 +1,25 @@ +--- +title: Services.jsm +slug: Mozilla/JavaScript_code_modules/Geometry.jsm/Services.jsm +translation_of: Mozilla/JavaScript_code_modules/Services.jsm +--- +<p>{{ gecko_minversion_header("2") }}</p> +<p>The <code>Services.jsm</code> 模块提供了一系列的javascript模块,用来简化各种常用的操作.</p> +<p>在使用它们之前,你必须首先将<code>Services</code>模块导入到自己的作用域内:</p> +<pre class="eval"><span class="nowiki">Components.utils.import("resource://gre/modules/Services.jsm");</span> +</pre> +<p>然后你可以通过服务访问器来轻松的从<code>Services对象导出所需要的模块</code>. 例如,要想获取一个preferences服务,你可以用下面的语句:</p> +<pre class="brush: js">var prefsService = Services.prefs; +</pre> +<h2 id="服务访问器">服务访问器</h2> +<table class="standard-table" style="width: auto;"> <tbody> <tr> <td class="header"><span class="short_text" id="result_box" lang="zh-CN"><span>服务</span><span class="alt-edited">访问器</span></span></td> <td class="header">服务接口</td> <td class="header">服务名</td> </tr> <tr> <td><code>appinfo</code></td> <td>{{ interface("nsIXULAppInfo") }}<br> {{ interface("nsIXULRuntime") }}</td> <td>Application information service</td> </tr> + <tr> <td><code>console</code></td> <td>{{ interface("nsIConsoleService") }}</td> <td>Error console service</td> </tr> <tr> <td><code>contentPrefs</code></td> <td>{{ interface("nsIContentPrefService") }}</td> <td> <p>Content Preferences service</p> </td> </tr> <tr> <td><code>cookies</code></td> <td>{{ interface("nsICookieManager2") }}</td> <td> <p>Cookie Manager 2 service</p> </td> </tr> <tr> <td><code>dirsvc</code></td> <td>{{ interface("nsIDirectoryService") }}<br> {{ interface("nsIProperties") }}</td> <td>Directory service</td> </tr> <tr> <td><code>droppedLinkHandler</code></td> <td>{{ interface("nsIDroppedLinkHandler") }}</td> <td>Dropped link handler service</td> </tr> <tr> <td><code>eTLD</code></td> <td>{{ interface("nsIEffectiveTLDService") }}</td> <td> <p>EffectiveTLD service</p> </td> </tr> <tr> <td><code>io</code></td> <td>{{ interface("nsIIOService") }}<br> {{ interface("nsIIOService2") }}</td> <td>I/O Service</td> </tr> <tr> <td><code>locale</code></td> <td>{{ interface("nsILocaleService") }}</td> <td>Locale service</td> </tr> <tr> <td><code>logins</code></td> <td>{{ interface("nsILoginManager") }}</td> <td> <p>Password Manager service</p> </td> </tr> <tr> <td><code>obs</code></td> <td>{{ interface("nsIObserverService") }}</td> <td>Observer service</td> </tr> <tr> <td><code>perms</code></td> <td>{{ interface("nsIPermissionManager") }}</td> <td>Permission manager service</td> </tr> <tr> <td><code>prefs</code></td> <td>{{ interface("nsIPrefBranch") }}<br> {{ interface("nsIPrefBranch2") }}<br> {{ interface("nsIPrefService") }}</td> <td>Preferences service</td> </tr> <tr> <td><code>prompt</code></td> <td>{{ interface("nsIPromptService") }}</td> <td>Prompt service</td> </tr> <tr> <td><code>scriptloader</code></td> <td>{{ interface("mozIJSSubScriptLoader") }}</td> <td>JavaScript subscript loader service</td> </tr> <tr> <td><code>search</code></td> <td>{{ interface("nsIBrowserSearchService") }}</td> <td>Browser search service1</td> </tr> <tr> <td><code>startup</code></td> <td>{{ interface("nsIAppStartup") }}</td> <td>Application startup service</td> </tr> <tr> <td><code>storage</code></td> <td>{{ interface("mozIStorageService") }}</td> <td><a href="/zh-cn/Storage" title="zh-cn/Storage">Storage API</a> service</td> </tr> <tr> <td><code>strings</code></td> <td>{{ interface("nsIStringBundleService") }}</td> <td>String bundle service</td> </tr> <tr> <td><code>sysinfo</code></td> <td>{{ interface("nsIPropertyBag2") }}</td> <td>System info service</td> </tr> <tr> <td><code>telemetry</code></td> <td>{{ interface("nsITelemetry") }}</td> <td>Telemetry service</td> </tr> <tr> <td><code>tm</code></td> <td>{{ interface("nsIThreadManager") }}</td> <td><a href="/zh-cn/The_Thread_Manager" title="zh-cn/The Thread Manager">Thread Manager</a> service</td> </tr> <tr> <td><code>urlFormatter</code></td> <td>{{ interface("nsIURLFormatter") }}</td> <td> <p>URL Formatter service</p> </td> </tr> <tr> <td><code>vc</code></td> <td>{{ interface("nsIVersionComparator") }}</td> <td>Version comparator service</td> </tr> <tr> <td><code>wm</code></td> <td>{{ interface("nsIWindowMediator") }}</td> <td>Window mediator service</td> </tr> <tr> <td><code>ww</code></td> <td>{{ interface("nsIWindowWatcher") }}</td> <td>Window watcher service</td> </tr> <tr> <td><code>DOMRequest</code></td> <td>{{ interface("nsIDOMRequestService") }}</td> <td>DOMRequest service</td> </tr> <tr> <td><code>cpmm</code></td> <td>{{ interface("nsIFrameMessageManager") }}</td> <td>Child Process Message Manager</td> </tr> <tr> <td>ppmm</td> <td>{{ interface("nsIFrameMessageManager") }}</td> <td>Parent Process Message Manager</td> </tr> </tbody> +</table> +<p>Thunderbird 和 SeaMonkey中该特性不可用.</p> +<h2 id="相关链接">相关链接</h2> +<ul> <li><a class="internal" href="/zh-cn/JavaScript_code_modules/Using" title="zh-cn/JavaScript code modules/Using + JavaScript code + modules">Using JavaScript code modules</a></li> <li><a class="internal" href="/zh-cn/JavaScript_code_modules" title="zh-cn/JavaScript code + modules">JavaScript code modules</a></li> <li><a class="internal" href="/zh-cn/XPCOM/mozilla::services_namespace" title="mozilla::services C++ namespace">mozilla::services C++ namespace</a></li> +</ul> +<p>{{ languages( { "en": "en/JavaScript_code_modules/Services.jsm" } ) }}</p> |