-
Notifications
You must be signed in to change notification settings - Fork 22.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Navigator.serial and WorkerNavigator.serial (#2806)
* Navigator.serial and WorkerNavigator.serial * Update files/en-us/web/api/navigator/serial/index.html Co-authored-by: Joe Medley <jmedley@google.com> * Update files/en-us/web/api/workernavigator/serial/index.html Co-authored-by: Joe Medley <jmedley@google.com> Co-authored-by: Joe Medley <jmedley@google.com>
- Loading branch information
1 parent
5dd6db3
commit 9244705
Showing
4 changed files
with
130 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
--- | ||
title: Navigator.serial | ||
slug: Web/API/Navigator/serial | ||
tags: | ||
- API | ||
- Property | ||
- Reference | ||
- serial | ||
- Navigator | ||
--- | ||
<div>{{APIRef("HTML DOM")}}</div> | ||
|
||
<p class="summary">The <strong><code>serial</code></strong> read-only property of the {{domxref("Navigator")}} interface returns a {{domxref("Serial")}} object which represents the entry point into the {{domxref("Web Serial API")}}.</p> | ||
|
||
<p>When getting, the same instance of the {{domxref("Serial")}} object will always be returned.</p> | ||
|
||
<h2 id="Syntax">Syntax</h2> | ||
|
||
<pre class="syntaxbox">var <var>serialObj</var> = Navigator.serial;</pre> | ||
|
||
<h3>Value</h3> | ||
<p>A {{domxref("Serial")}} object.</p> | ||
|
||
<h2 id="Examples">Examples</h2> | ||
|
||
<p>The following example uses the <code>getPorts()</code> method to initialize a list of available ports.</p> | ||
|
||
<pre class="brush: js notranslate">navigator.serial.getPorts() | ||
.then((ports) => { | ||
// Initialize the list of available ports with `ports` on page load. | ||
});</pre> | ||
|
||
<h2 id="Specifications">Specifications</h2> | ||
|
||
<table class="standard-table"> | ||
<tbody> | ||
<tr> | ||
<th scope="col">Specification</th> | ||
<th scope="col">Status</th> | ||
<th scope="col">Comment</th> | ||
</tr> | ||
<tr> | ||
<td>{{SpecName('Web Serial API','#extensions-to-the-navigator-interface','Extensions to the Navigator Interface')}}</td> | ||
<td>{{Spec2('Web Serial API')}}</td> | ||
<td>Initial definition.</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
<h2 id="Browser_compatibility">Browser compatibility</h2> | ||
|
||
<div class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</div> | ||
|
||
<p>{{Compat("api.Navigator.serial")}}</p> | ||
|
||
<h2 id="See_also">See also</h2> | ||
|
||
<ul> | ||
<li><a href="https://web.dev/serial/">Read from and write to a serial port</a></li> | ||
<li><a href="https://codelabs.developers.google.com/codelabs/web-serial#0">Getting started with the web serial API</a></li> | ||
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
--- | ||
title: WorkerNavigator.serial | ||
slug: Web/API/WorkerNavigator/serial | ||
tags: | ||
- API | ||
- Property | ||
- Reference | ||
- serial | ||
- WorkerNavigator | ||
--- | ||
<p>{{APIRef("Web Workers API")}}</p> | ||
|
||
<p class="summary">The <strong><code>serial</code></strong> read-only property of the {{domxref("WorkerNavigator")}} interface returns a {{domxref("Serial")}} object which represents the entry point into the {{domxref("Web Serial API")}}.</p> | ||
|
||
<p>When getting, the same instance of the {{domxref("Serial")}} object will always be returned.</p> | ||
|
||
<h2 id="Syntax">Syntax</h2> | ||
|
||
<pre class="syntaxbox">var <var>serialObj</var> = self.navigator.serial;</pre> | ||
|
||
<h3>Value</h3> | ||
<p>A {{domxref("Serial")}} object.</p> | ||
|
||
<h2 id="Examples">Examples</h2> | ||
|
||
<p>The following example uses the <code>getPorts()</code> method to initialize a list of available ports.</p> | ||
|
||
<pre class="brush: js notranslate">self.navigator.serial.getPorts() | ||
.then((ports) => { | ||
// Initialize the list of available ports. | ||
});</pre> | ||
|
||
<h2 id="Specifications">Specifications</h2> | ||
|
||
<table class="standard-table"> | ||
<tbody> | ||
<tr> | ||
<th scope="col">Specification</th> | ||
<th scope="col">Status</th> | ||
<th scope="col">Comment</th> | ||
</tr> | ||
<tr> | ||
<td>{{SpecName('Web Serial API','#extensions-to-the-workernavigator-interface','Extensions to the Worker Navigator Interface')}}</td> | ||
<td>{{Spec2('Web Serial API')}}</td> | ||
<td>Initial definition.</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
<h2 id="Browser_compatibility">Browser compatibility</h2> | ||
|
||
<div class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</div> | ||
|
||
<p>{{Compat("api.WorkerNavigator.serial")}}</p> | ||
|
||
<h2 id="See_also">See also</h2> | ||
|
||
<ul> | ||
<li><a href="https://web.dev/serial/">Read from and write to a serial port</a></li> | ||
<li><a href="https://codelabs.developers.google.com/codelabs/web-serial#0">Getting started with the web serial API</a></li> | ||
</ul> |